Project

General

Profile

Task #2128

Switch to better reporting mechanism

Added by Luke Murphey over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Start date:
11/02/2017
Due date:
% Done:

100%

Associated revisions

Revision 54 (diff)
Added by lukemurphey over 6 years ago

Adding HTML test reporter

Reference #2128

History

#3 Updated by Luke Murphey over 6 years ago

HtmlTestRunner doesn't allow you to set a static file name.

Here is what I am considering:
  • Setting outsuffix so that the file doesn't have the time markers
    • This causes the file to not even have an ending
    • The file name will still change depending on the test name which means GoCD cannot pull it in
  • Renaming the file when done
    • This doesn't work since the test runner calls exit()
  • The system creates multiple HTML files (one for each class)

#4 Updated by Luke Murphey over 6 years ago

See also http://tungwaiyip.info/software/HTMLTestRunner.html

  • Isn't capable of running the entire test suite without declaring the entire test suite
  • Apparently doesn't run all tests from a suite via a list from loader.loadTestsFromTestCase()
  • Doesn't allow running individual tests via CLI options

#5 Updated by Luke Murphey over 6 years ago

  • Project changed from Webhooks Input to Splunk Apps

#6 Updated by Luke Murphey over 6 years ago

  • splunk-app-unit-tests-6.2-plus
    • [Done] webhooks-input
    • [Done] web-input
    • [Done] ftp-receiver
    • [Done] syndication-input
    • [Done] network-tools
  • splunk-app-unit-tests-6.3-plus
    • [Done] website-monitoring
  • splunk-app-unit-tests-6.0-plus
    • [Done] file-info
  • splunk-app-unit-tests-6.4-plus
    • [Done] lookup-editor

#8 Updated by Luke Murphey over 6 years ago

I don't think it is logging skipped tests.

#9 Updated by Luke Murphey over 6 years ago

For future reference, here is how I am upgrading the tests:

Add the following imports:

import errno
import HTMLTestRunner

Make sure to put the HTMLTestRunner class next to unit.py.

Then add the test code:

if __name__ == '__main__':
    report_path = os.path.join('..', os.environ.get('TEST_OUTPUT', 'tmp/test_report.html'))

    # Make the test directory
    try:
        os.makedirs(os.path.dirname(report_path))
    except OSError as exception:
        if exception.errno != errno.EEXIST:
            raise

    with open(report_path, 'w') as report_file:
        test_runner = HTMLTestRunner.HTMLTestRunner(
            stream=report_file
        )
        unittest.main(testRunner=test_runner)

#10 Updated by Luke Murphey over 6 years ago

  • % Done changed from 0 to 80

#11 Updated by Luke Murphey over 6 years ago

  • Status changed from New to Closed
  • % Done changed from 80 to 100

Also available in: Atom PDF