Unit Theory Flashcards

1
Q

What is pyunit

A

Unit testing framework for python
Advocates first testing then coding
Set up test data for a piece of code
Test the test set up
Write the code
Then unit test the code using test set up
Can increase programme productivity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why use unit tests

A

Help developers verify that the logic of a piece of code is correct
Re performing unit tests can identify software regressions introduced by changes in the code
May not be suitable for all code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What happens when unit tests fails

A

For an individual programmer - compilation will fail until unit test passes
For a group programming together - the group build will fail unless all unit tests pass

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Continuous integration

A

Development practice that requires developers to integrate code into a shared repository several times a day
Each check in verified by an automated build allowing teams to detect problems early
Automated builds are inherently associated with unit testing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Pyunit

A

Runs automatically
Checks results automatically and flags errors
No errors mean all test passed
Tests can be organised into suites of test cases
Quicker than manual testing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Pyunit test case

A

Piece of code that checks another piece of code works as expected
Testing framework that enables us to quickly develop execute and re execute unit test cases for pythonccode
A known input and expected output
Both input and expected outputs are identified before the test is executed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How many unit test cases

A

At least two unit test cases
One positive and negative test

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Positive test cases

A

Testing for something that should happen does happen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Negative testing

A

Testing for something that should not happen does not happen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly