ArturSpirin/test_junkie

Poor Traceback on bad parameters

ArturSpirin opened this issue · 1 comments

  1. Python version python --version >> 2 & 3
  2. Test Junkie version pip show test_junkie >> 0.4a4
  3. Platform aka Windows 10 or Linux Mint 18.1 >> N/A
  4. Command used, if running via terminal >> N/A
  5. Smallest code snippet that can reproduce the issue and /or description of the issue
@Suite(owner={"name": "John"})
class ExampleSuite:

    @test()
    def test_help(self):
        pass

runner = Runner([ExampleSuite], html_report="path/to/file/report.html", monitor_resources=True)
runner.run()

Expected behaviour

Error is raised that helps to track down where incorrect input was set

Actual behaviour

Currently can't track where the issue is based on the traceback

Traceback (most recent call last):
  File "E:/Development/test_junkie/playground/run.py", line 19, in <module>
    aggregator = runner.run(test_multithreading_limit=10)
  File "E:\Development\test_junkie\test_junkie\runner.py", line 256, in run
    aggregator=aggregator)
  File "E:\Development\test_junkie\test_junkie\reporter\reporter.py", line 22, in __init__
    self.owners = aggregator.get_report_by_owner()
  File "E:\Development\test_junkie\test_junkie\metrics.py", line 142, in get_report_by_owner
    if owner not in report:
TypeError: unhashable type: 'dict'

Test Junkie will now validate that all of the test and suite properties are using correct data types when it builds the definitions for Suite Objects. If an issue is detected, it will now be communicated in a similar stacktrace as bellow:

Traceback (most recent call last):
  File "E:/Development/test_junkie/playground/run.py", line 12, in <module>
    from playground.suiteA import TestSuiteA
  File "E:\Development\test_junkie\playground\suiteA.py", line 17, in <module>
    class TestSuiteA(TestRules):
  File "E:\Development\test_junkie\test_junkie\decorators.py", line 17, in __call__
    decorator_type=DecoratorType.TEST_SUITE)
  File "E:\Development\test_junkie\test_junkie\builder.py", line 52, in build_suite_definitions
    Builder.__validate_suite_kwargs(decorator_kwargs)
  File "E:\Development\test_junkie\test_junkie\builder.py", line 114, in __validate_suite_kwargs
    DocumentationLinks.SUITE_DECORATOR))
test_junkie.errors.BadParameters: Argument: "parameters" in @Suite() decorator must be of either type: ["<type 'function'>", <class 'list'>] but found: <class 'dict'>. For more info, see @Suite() decorator documentation: https://github.com/ArturSpirin/test_junkie#suite