-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Report collected results #9
Commits on Mar 18, 2023
-
assert for
result.summary
attestTemplateMethod()
This change will enable us to display a visual report of the tests being run, so we can give feedback to users (instead of the program just blankly finishing) 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 12, in <module> TestCaseTest("testTemplateMethod").run() File "tdd-xunit-example/src/test_case.py", line 12, in run method() File "tdd-xunit-example/src/test_case_test.py", line 9, in testTemplateMethod assert ("1 run, 0 failed" == result.summary()) ^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'summary'
Configuration menu - View commit details
-
Copy full SHA for 7e487a8 - Browse repository at this point
Copy the full SHA 7e487a8View commit details -
introduce a
TestResult
class with hardcoded implThis class will be used to hold a summary of the test suite execution. For now, though, it's just implementing a summary method with a hardcoded implementation. 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 12, in <module> TestCaseTest("testTemplateMethod").run() File "tdd-xunit-example/src/test_case.py", line 12, in run method() File "tdd-xunit-example/src/test_case_test.py", line 9, in testTemplateMethod assert ("1 run, 0 failed" == result.summary()) ^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'summary'
Configuration menu - View commit details
-
Copy full SHA for 2475871 - Browse repository at this point
Copy the full SHA 2475871View commit details -
return an instance of
TestResult
atTestCase.run()
Checklist: - Invoke tearDown even if the test method fails - Run multiple tests - Report collected results 👈🏼
Configuration menu - View commit details
-
Copy full SHA for e744108 - Browse repository at this point
Copy the full SHA e744108View commit details -
introduce symbolic constant
runCount
This instance variable will be used to hold the number of tests there were ran in a test session. For now, though, it is hardcoded to the value 1. Checklist: - Invoke tearDown even if the test method fails - Run multiple tests - Report collected results 👈🏼
Configuration menu - View commit details
-
Copy full SHA for 4334eaf - Browse repository at this point
Copy the full SHA 4334eafView commit details -
implement
testStarted()
atTestResult
This method will be responsible for updating the value of runCount everytime a test is executed 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 12, in <module> TestCaseTest("testTemplateMethod").run() File "tdd-xunit-example/src/test_case.py", line 15, in run method() File "tdd-xunit-example/src/test_case_test.py", line 9, in testTemplateMethod assert ("1 run, 0 failed" == result.summary()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError
Configuration menu - View commit details
-
Copy full SHA for 69d2a11 - Browse repository at this point
Copy the full SHA 69d2a11View commit details -
update
TestCase.run()
to callTestResult.testStarted()
This call is needed so we can increment the runCount variable and compute the number of tests ran in a session Checklist: - Invoke tearDown even if the test method fails - Run multiple tests - Report collected results 👈🏼
Configuration menu - View commit details
-
Copy full SHA for 5d7469b - Browse repository at this point
Copy the full SHA 5d7469bView commit details -
add test for a failed test report
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 16, in run method = getattr(self, self.name) ^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'WasRun' object has no attribute 'testBrokenMethod'
Configuration menu - View commit details
-
Copy full SHA for 751d37d - Browse repository at this point
Copy the full SHA 751d37dView commit details -
implement
testBrokenMethod()
atWasRun
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
Configuration menu - View commit details
-
Copy full SHA for 47adee2 - Browse repository at this point
Copy the full SHA 47adee2View commit details