Skip to content
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

Bootstrap the testing framework #1

Merged
merged 13 commits into from
Mar 18, 2023
Merged

Conversation

kaiosilveira
Copy link
Owner

@kaiosilveira kaiosilveira commented Mar 17, 2023

Chapter 18: First steps to xUnit

Our goal in this chapter was to bootstrap our testing framework and use it to test itself. We accomplished that by making teeny-tiny steps towards a TestCase class, which will be the core part of our system, and finished with a test for the class itself.

Implementation checklist:

Invoke test method
☑️ Invoke setUp first
☑️ Invoke tearDown afterward
☑️ Invoke tearDown even if the test method fails
☑️ Run multiple tests
☑️ Report collected results

Closes #3

@kaiosilveira kaiosilveira force-pushed the chapter18/first-steps-to-xunit branch 8 times, most recently from bcf3dfc to 5dfdef8 Compare March 17, 2023 18:49
@kaiosilveira kaiosilveira changed the title add initial exploratory code to kick off the implementation Bootstrap the testing framework Mar 17, 2023
@kaiosilveira kaiosilveira force-pushed the chapter18/first-steps-to-xunit branch 7 times, most recently from 93aa8b9 to 2fb6ee7 Compare March 18, 2023 09:39
Checklist:
- Invoke test method 👈🏼
- Invoke setUp first
- Invoke tearDown afterward
- Invoke tearDown even if the test method fails
- Run multiple tests
- Report collected results

---

Output:
➜ python3 index.py
Traceback (most recent call last):
  File "tdd-xunit-example/index.py", line 1, in <module>
    test = WasRun("testMethod")
           ^^^^^^
NameError: name 'WasRun' is not defined
Checklist:
- Invoke test method 👈🏼
- Invoke setUp first
- Invoke tearDown afterward
- Invoke tearDown even if the test method fails
- Run multiple tests
- Report collected results

---

Output:
➜ python3 src/index.py
Traceback (most recent call last):
  File "tdd-xunit-example/src/index.py", line 3, in <module>
    test = WasRun("testMethod")
           ^^^^^^^^^^^^^^^^^^^^
TypeError: WasRun() takes no arguments
Checklist:
- Invoke test method 👈🏼
- Invoke setUp first
- Invoke tearDown afterward
- Invoke tearDown even if the test method fails
- Run multiple tests
- Report collected results

---

Output:
➜ python3 src/index.py
None
Traceback (most recent call last):
  File "tdd-xunit-example/src/index.py", line 5, in <module>
    test.testMethod()
    ^^^^^^^^^^^^^^^
AttributeError: 'WasRun' object has no attribute 'testMethod'
Checklist:
- Invoke test method 👈🏼
- Invoke setUp first
- Invoke tearDown afterward
- Invoke tearDown even if the test method fails
- Run multiple tests
- Report collected results

---

Output:
➜ python3 src/index.py
None
None
Checklist:
- Invoke test method 👈🏼
- Invoke setUp first
- Invoke tearDown afterward
- Invoke tearDown even if the test method fails
- Run multiple tests
- Report collected results

---

Output:
➜ python3 src/index.py
None
1
Checklist:
- Invoke test method 👈🏼
- Invoke setUp first
- Invoke tearDown afterward
- Invoke tearDown even if the test method fails
- Run multiple tests
- Report collected results

---

Output:
➜ python3 src/index.py
None
Traceback (most recent call last):
  File "tdd-xunit-example/src/index.py", line 5, in <module>
    test.run()
    ^^^^^^^^
AttributeError: 'WasRun' object has no attribute 'run'
Checklist:
- Invoke test method 👈🏼
- Invoke setUp first
- Invoke tearDown afterward
- Invoke tearDown even if the test method fails
- Run multiple tests
- Report collected results

---

Output:
➜ python3 src/index.py
None
1
Checklist:
- Invoke test method 👈🏼
- Invoke setUp first
- Invoke tearDown afterward
- Invoke tearDown even if the test method fails
- Run multiple tests
- Report collected results

---

Output:
➜ python3 src/index.py
None
1
Checklist:
- Invoke test method 👈🏼
- Invoke setUp first
- Invoke tearDown afterward
- Invoke tearDown even if the test method fails
- Run multiple tests
- Report collected results
Checklist:
- Invoke test method 👈🏼
- Invoke setUp first
- Invoke tearDown afterward
- Invoke tearDown even if the test method fails
- Run multiple tests
- Report collected results
Checklist:
- Invoke test method 👈🏼
- Invoke setUp first
- Invoke tearDown afterward
- Invoke tearDown even if the test method fails
- Run multiple tests
- Report collected results
Checklist:
- Invoke test method 👈🏼
- Invoke setUp first
- Invoke tearDown afterward
- Invoke tearDown even if the test method fails
- Run multiple tests
- Report collected results
@kaiosilveira kaiosilveira force-pushed the chapter18/first-steps-to-xunit branch from 2fb6ee7 to 3a3422a Compare March 18, 2023 09:46
@kaiosilveira kaiosilveira force-pushed the chapter18/first-steps-to-xunit branch from 3a3422a to 3c77585 Compare March 18, 2023 09:52
Checklist:
- Invoke test method ✅
- Invoke setUp first
- Invoke tearDown afterward
- Invoke tearDown even if the test method fails
- Run multiple tests
- Report collected results
@kaiosilveira kaiosilveira force-pushed the chapter18/first-steps-to-xunit branch from 3c77585 to bf17e19 Compare March 18, 2023 09:54
@kaiosilveira kaiosilveira marked this pull request as ready for review March 18, 2023 10:50
@kaiosilveira kaiosilveira linked an issue Mar 18, 2023 that may be closed by this pull request
@kaiosilveira kaiosilveira merged commit 94b0034 into main Mar 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chapter 18: First steps to xUnit
1 participant