1/12
Flashcards on testing and debugging concepts.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is the purpose of unit testing?
To test individual units or components of code to ensure their proper functioning.
Where should all tests be located within a unittest file?
Inside a subclass TestCase from the library unittest.
How should every test function be named inside the class?
It should start with the name test_.
What should be used to check for expected results in unit tests?
Assert methods.
What is the purpose of the setUp() method in unit testing?
It is called before every test, and should contain definitions needed for every test.
What is the purpose of the tearDown() method in unit testing?
It is called after every test and should contain definitions to reset after every test.
Name 3 assert methods
assertTrue, assertFalse, assertEqual
Why use assertAlmostEqual?
Use this one compare comparing floating point numbers.
How to reload window in VSCode (windows)?
Control + Shift + p
How to reload window in VSCode (mac)?
Command + Shift + p
What command line can be used if the explorer is not working and doesn’t run the tests?
python -m unittest discover -v -s . -p "test_*.py"
What is a Mock object?
Mock objects imitate the real object that make up your program but with fake data. They are usually used for API calls (server)
What does Code Coverage do?
A code coverage keeps track of which lines of code are (and aren't) executed while tests are running