Skip to content

Commit

Permalink
Updating python functional tests to print error to console if any (mi…
Browse files Browse the repository at this point in the history
…crosoft#188)

* Functional test adding logs

* Review comments
  • Loading branch information
issacnitinmsft authored Jul 22, 2019
1 parent a040b47 commit f02fb0b
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def setUp(self):
options = webdriver.ChromeOptions()
options.add_argument('--no-sandbox')
self.driver = webdriver.Chrome(os.path.join(os.environ["ChromeWebDriver"], 'chromedriver.exe'), chrome_options=options)
self.driver.implicitly_wait(120)
self.driver.implicitly_wait(300)

def test_selenium(self):
webAppUrl = pytest.config.getoption('webAppUrl')
Expand All @@ -24,13 +24,12 @@ def test_selenium(self):
title = self.driver.title
self.assertIn("Home Page - Python Bottle Application", title)
break
except AssertionError:
except Exception as e:
current_timestamp = time.time()
if(current_timestamp > end_timestamp):
print('"##vso[task.logissue type=error;]Test test_selenium failed with error: ' + str(e))
raise
time.sleep(5)
except Exception as e:
pytest.fail('tests_selenium.Error occurred while executing tests: ' + str(e))

def tearDown(self):
try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def setUp(self):
options = webdriver.ChromeOptions()
options.add_argument('--no-sandbox')
self.driver = webdriver.Chrome(os.path.join(os.environ["ChromeWebDriver"], 'chromedriver.exe'), chrome_options=options)
self.driver.implicitly_wait(120)
self.driver.implicitly_wait(300)

def test_selenium(self):
webAppUrl = pytest.config.getoption('webAppUrl')
Expand All @@ -24,13 +24,12 @@ def test_selenium(self):
title = self.driver.title
self.assertIn("Home Page - Python Bottle Application", title)
break
except AssertionError:
except Exception as e:
current_timestamp = time.time()
if(current_timestamp > end_timestamp):
print('"##vso[task.logissue type=error;]Test test_selenium failed with error: ' + str(e))
raise
time.sleep(5)
except Exception as e:
pytest.fail('tests_selenium.Error occurred while executing tests: ' + str(e))

def tearDown(self):
try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def setUp(self):
options = webdriver.ChromeOptions()
options.add_argument('--no-sandbox')
self.driver = webdriver.Chrome(os.path.join(os.environ["ChromeWebDriver"], 'chromedriver.exe'), chrome_options=options)
self.driver.implicitly_wait(120)
self.driver.implicitly_wait(300)

def test_selenium(self):
webAppUrl = pytest.config.getoption('webAppUrl')
Expand All @@ -24,13 +24,12 @@ def test_selenium(self):
title = self.driver.title
self.assertIn("Home Page - Python Django Application", title)
break
except AssertionError:
except Exception as e:
print('"##vso[task.logissue type=error;]Test test_selenium failed with error: ' + str(e))
current_timestamp = time.time()
if(current_timestamp > end_timestamp):
raise
time.sleep(5)
except Exception as e:
pytest.fail('tests_selenium.Error occurred while executing tests: ' + str(e))

def tearDown(self):
try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def setUp(self):
options = webdriver.ChromeOptions()
options.add_argument('--no-sandbox')
self.driver = webdriver.Chrome(os.path.join(os.environ["ChromeWebDriver"], 'chromedriver.exe'), chrome_options=options)
self.driver.implicitly_wait(120)
self.driver.implicitly_wait(300)

def test_selenium(self):
webAppUrl = pytest.config.getoption('webAppUrl')
Expand All @@ -24,13 +24,12 @@ def test_selenium(self):
title = self.driver.title
self.assertIn("Home Page - Python Django Application", title)
break
except AssertionError:
except Exception as e:
print('"##vso[task.logissue type=error;]Test test_selenium failed with error: ' + str(e))
current_timestamp = time.time()
if(current_timestamp > end_timestamp):
raise
time.sleep(5)
except Exception as e:
pytest.fail('tests_selenium.Error occurred while executing tests: ' + str(e))

def tearDown(self):
try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def setUp(self):
options = webdriver.ChromeOptions()
options.add_argument('--no-sandbox')
self.driver = webdriver.Chrome(os.path.join(os.environ["ChromeWebDriver"], 'chromedriver.exe'), chrome_options=options)
self.driver.implicitly_wait(120)
self.driver.implicitly_wait(300)

def test_selenium(self):
webAppUrl = pytest.config.getoption('webAppUrl')
Expand All @@ -24,13 +24,12 @@ def test_selenium(self):
title = self.driver.title
self.assertIn("Home Page - Python Flask Application", title)
break
except AssertionError:
except Exception as e:
print('"##vso[task.logissue type=error;]Test test_selenium failed with error: ' + str(e))
current_timestamp = time.time()
if(current_timestamp > end_timestamp):
raise
time.sleep(5)
except Exception as e:
pytest.fail('tests_selenium.Error occurred while executing tests: ' + str(e))

def tearDown(self):
try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def setUp(self):
options = webdriver.ChromeOptions()
options.add_argument('--no-sandbox')
self.driver = webdriver.Chrome(os.path.join(os.environ["ChromeWebDriver"], 'chromedriver.exe'), chrome_options=options)
self.driver.implicitly_wait(120)
self.driver.implicitly_wait(300)

def test_selenium(self):
webAppUrl = pytest.config.getoption('webAppUrl')
Expand All @@ -24,13 +24,12 @@ def test_selenium(self):
title = self.driver.title
self.assertIn("Home Page - Python Flask Application", title)
break
except AssertionError:
except Exception as e:
print('"##vso[task.logissue type=error;]Test test_selenium failed with error: ' + str(e))
current_timestamp = time.time()
if(current_timestamp > end_timestamp):
raise
time.sleep(5)
except Exception as e:
pytest.fail('tests_selenium.Error occurred while executing tests: ' + str(e))

def tearDown(self):
try:
Expand Down

0 comments on commit f02fb0b

Please sign in to comment.