Testing and Debugging

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/12

flashcard set

Earn XP

Description and Tags

Flashcards on testing and debugging concepts.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

13 Terms

1
New cards

What is the purpose of unit testing?

To test individual units or components of code to ensure their proper functioning.

2
New cards

Where should all tests be located within a unittest file?

Inside a subclass TestCase from the library unittest.

3
New cards

How should every test function be named inside the class?

It should start with the name test_.

4
New cards

What should be used to check for expected results in unit tests?

Assert methods.

5
New cards

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.

6
New cards

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.

7
New cards

Name 3 assert methods

assertTrue, assertFalse, assertEqual

8
New cards

Why use assertAlmostEqual?

Use this one compare comparing floating point numbers.

9
New cards

How to reload window in VSCode (windows)?

Control + Shift + p

10
New cards

How to reload window in VSCode (mac)?

Command + Shift + p

11
New cards

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"

12
New cards

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)

13
New cards

What does Code Coverage do?

A code coverage keeps track of which lines of code are (and aren't) executed while tests are running