Unit Testing Flashcards

1
Q

What does setup in nunit do?

A

It is used to provide a set of functions that are performed just before each test method is called

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

What are the three parts of a unit test

A

Arrange, Act, Assert

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

What are the characteristics of a good unit test

A

Fast: Takes little time to run.

Isolated: have no dependencies on any outside factors.

Repeatable: consistent with its results.

Self-Checking: automatically detect if it passed or failed.

Timely: should not take a long time to write.

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

What is the TDD cycle?

A

Fail, Pass, Refactor

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

What advantages of using TDD?

A

Better program design and code quality, reduces time required for project development, easier maintenance

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

If a Nunit class has a constructor, when does it run?

A

They only run once per test class. Test run with any order, usually alphabetically by default.

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

What does the [TestCaseSource] attribute do?

A

Uses a reference field, method or property that has test arguements that can be applied to multiple parameterized test methods.

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

What are the pitfalls of doing TDD?

A

You might have to rewrite code that doesn’t work anymore the further you go. You might end up with redundant tests over simple functionality

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