HtmlTestRunner
HtmlTestRunner copied to clipboard
How to combine HTMLTestRunner with nosetests?
- HtmlTestRunner version: 1.1.1
- Python version: 3.6
- Operating System: Ubuntu Linux
Description
I tried out your example on the main page including the
if __name__ == '__main__':
unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output='example_dir'))
and ran it as suggested with 'python test.py' which works fine and generates a nice HTML report.
However, i was wondering if there is any possibility to combine HTMLTestRunner with nosetests.
I tried the following:
>>> nosetests tests/test_HTMLTestRunner.py -vv
nose.config: INFO: Ignoring files matching ['^\\.', '^_', '^setup\\.py$']
This test should be marked as error one. ... ERROR
This test should fail. ... FAIL
test_isupper (tests.test_HTMLTestRunner.TestStringMethods) ... ok
This test should be skipped. ... SKIP: This is a skipped test.
test_split (tests.test_HTMLTestRunner.TestStringMethods) ... ok
test_upper (tests.test_HTMLTestRunner.TestStringMethods) ... ok
======================================================================
ERROR: This test should be marked as error one.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/testproject/tests/test_HTMLTestRunner.py", line 24, in test_error
raise ValueError
ValueError
======================================================================
FAIL: This test should fail.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/testproject/tests/test_HTMLTestRunner.py", line 28, in test_fail
self.assertEqual(1, 2)
AssertionError: 1 != 2
----------------------------------------------------------------------
Ran 6 tests in 0.003s
FAILED (SKIP=1, errors=1, failures=1)
So the tests are working as expected but no HTML outputs are generated. Do you have a suggestion how to get this to work?
Hi, I haven't tested it with nose test, I will research it and let you know.
Thanks! It would really nice to combine it with nosetests!
Hi, Is nose-test is updated with Htmltestrunner for generating coverage report of testcase module?
no yet, now that I have free time I will look how to hook htmltestrunner with nose