Skip to content

Commit

Permalink
implement testBrokenMethod() at WasRun
Browse files Browse the repository at this point in the history
This implementation will support the code being executed as part of TestCase.testFailedResult. For now, though, we're just raising an exception.

Checklist:
- Invoke tearDown even if the test method fails
- Run multiple tests
- Report collected results ✅

---

Output:
➜ python3 src/test_case_test.py
Traceback (most recent call last):
  File "tdd-xunit-example/src/test_case_test.py", line 18, in <module>
    TestCaseTest("testFailedResult").run()
  File "tdd-xunit-example/src/test_case.py", line 17, in run
    method()
  File "tdd-xunit-example/src/test_case_test.py", line 13, in testFailedResult
    result = test.run()
             ^^^^^^^^^^
  File "tdd-xunit-example/src/test_case.py", line 17, in run
    method()
  File "tdd-xunit-example/src/was_run.py", line 20, in testBrokenMethod
    raise Exception
Exception
  • Loading branch information
kaiosilveira committed Mar 18, 2023
1 parent 751d37d commit 47adee2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/was_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ def testMethod(self) -> None:

def tearDown(self) -> None:
self.log = self.log + "tearDown "

def testBrokenMethod(self) -> None:
raise Exception

0 comments on commit 47adee2

Please sign in to comment.