Merge pull request #96 from seleniumbase/upgrade-reports

Upgrade Nosetest Reports
This commit is contained in:
Michael Mintz 2017-04-28 02:37:17 -04:00 committed by GitHub
commit 9355e6a558
6 changed files with 20 additions and 17 deletions

3
.gitignore vendored
View File

@ -46,5 +46,8 @@ archived_logs
latest_report
report_archives
archived_reports
html_report.html
report.html
assets
temp
node_modules

View File

@ -287,14 +287,14 @@ nosetests my_test_suite.py --with-selenium --with-testing_base --report --browse
```
![](http://cdn2.hubspot.net/hubfs/100006/images/Test_Report_2.png "Example Nosetest Report")
(NOTE: You can add ``--hide_report`` to immediately archive the report rather than displaying it after the test suite completes. You'll want to use this when running tests remotely because otherwise the test run will hang indefinitely until someone manually exits the report.)
(NOTE: You can add ``--show_report`` to immediately display the report after the test suite completes. You don't want to use this when running tests remotely because otherwise the test run will hang indefinitely until someone manually exits the report.)
#### **Pytest Reports:**
Using ``--html=html_report.html`` gives you a fancy report of the name specified after your test suite completes.
Using ``--html=report.html`` gives you a fancy report of the name specified after your test suite completes.
```bash
pytest my_test_suite.py --with-selenium --html=html_report.html
pytest my_test_suite.py --with-selenium --html=report.html
```
![](https://cdn2.hubspot.net/hubfs/100006/images/PytestReport.png "Example Pytest Report")

View File

@ -125,7 +125,7 @@ def add_results_page(html):
def build_report(report_log_path, page_results_list,
successes, failures, browser_type,
hide_report):
show_report):
web_log_path = "file://%s" % report_log_path
successes_count = len(successes)
@ -218,11 +218,11 @@ def build_report(report_log_path, page_results_list,
print(
"\n* Files saved for this report are located at:\n" + report_log_path)
print("")
if not hide_report:
if browser_type == 'chrome':
browser = webdriver.Chrome()
else:
if show_report:
if browser_type == 'firefox':
browser = webdriver.Firefox()
else:
browser = webdriver.Chrome()
browser.get("file://%s" % archived_results_file)
print("\n*** Close the html report window to continue. ***")
while len(browser.window_handles):

View File

@ -53,10 +53,10 @@ class Base(Plugin):
default=False,
help='Create a fancy report at the end of the test suite.')
parser.add_option(
'--hide_report', action="store_true",
dest='hide_report',
'--show_report', action="store_true",
dest='show_report',
default=False,
help="If true while using report, it won't pop up after tests run")
help="If true when using report, will display it after tests run.")
def configure(self, options, conf):
super(Base, self).configure(options, conf)
@ -65,7 +65,7 @@ class Base(Plugin):
self.options = options
log_path = options.log_path
self.report_on = options.report
self.hide_report = options.hide_report
self.show_report = options.show_report
if log_path.endswith("/"):
log_path = log_path[:-1]
if not os.path.exists(log_path):
@ -108,7 +108,7 @@ class Base(Plugin):
self.page_results_list,
self.successes, self.failures,
self.options.browser,
self.hide_report)
self.show_report)
def __log_all_options_if_none_specified(self, test):
"""

View File

@ -8,8 +8,8 @@ from setuptools import setup, find_packages # noqa
setup(
name='seleniumbase',
version='1.3.14',
description='Test Automation Framework - seleniumbase.com',
version='1.3.15',
description='Test Automation Framework - http://seleniumbase.com',
long_description='Automation Framework for Simple & Reliable Web Testing',
platforms='Mac * Windows * Linux * Docker',
url='http://seleniumbase.com',

View File

@ -7,8 +7,8 @@ from setuptools import setup, find_packages # noqa
setup(
name='seleniumbase',
version='1.3.14',
description='Test Automation Framework - seleniumbase.com',
version='1.3.15',
description='Test Automation Framework - http://seleniumbase.com',
long_description='Automation Framework for Simple & Reliable Web Testing',
platforms='Mac * Windows * Linux * Docker',
url='http://seleniumbase.com',