Testing Flashcards

Osherove book

You may prefer our related Brainscape-certified flashcards:
1
Q

What is a unit test?

A

an automated piece of code that invokes another piece of code and checks one specific end result. The scope can be from a single method to multiple classes.

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

Properties of good unit tests

A

1) automated & repeatable
2) easy to implement
3) relevant in the future
4) runs quickly & easily (push of a button)
5) consistent in results
6) has full control of unit under test
7) isolated
8) when it fails the cause is easy to identify
(think of each individual car part, not the whole system)

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

What is an integration test?

A

Any test that is not fast, consistent, and/or uses dependencies. (Think of the whole car as a system)

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

What kind of test is one that uses the current time?

A

Integration (it’s not consistent)

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

What is a “regression?”

A

A unit of work the once worked but now doesn’t

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

Control flow code

A

any piece of code that has logic in it (loop, switch, etc.) You don’t need to test code without logic

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

How do you set up a simple unit test without a framework?

A

1) Create the test class
2) Invoke the class to be tested (Parser p = new Parset();)
3) Check the returned value
4) Invoke the test class by adding a Main as a test runner. You can add more method calls to this class

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

TDD technique (3 steps)

A

1) write failing test to prove functionality is missing
2) write code to make test pass (simple as possible)
3) refactor

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