Testing Flashcards

1
Q

What is software reliability?

A

Probability that a software system will not cause failure under specified conditions.

Measured by uptime, MTTF (mean time till failure), crash data.

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

How many bugs are estimated to be in complex software systems?

A

10-50 bugs per 1000 lines of code.

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

What is testing in software development?

A

A systematic attempt to reveal errors.

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

What does a failed test indicate?

A

An error was demonstrated.

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

What does a passed test indicate?

A

No error was found (for this particular situation).

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

What are unit tests?

A

Tests that should be non-interactive and made up of a huge number of statements that exercise some code and compare the computed result with the expected result.

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

What is the purpose of a test driver?

A

To report the number of successes and number of failures when finished.

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

What is the benefit of a comprehensive unit test suite?

A

Allows you to refactor your code with confidence.

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

What do unit tests typically contain?

A

Assertions about the behaviour of your software.

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

What is a JUnit test class?

A

A class created to test another class, containing various ‘test case’ methods to run.

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

What does the @Test annotation signify in JUnit?

A

Marks a method as a JUnit test case.

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

What does assertTrue(test) do?

A

Fails if the boolean test is false.

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

What does assertFalse(test) do?

A

Fails if the boolean test is true.

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

What does assertEquals(expected, actual) do?

A

Fails if the values are not equal.

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

What does assertNotNull(value) check?

A

Fails if the given value is null.

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

What is regression testing?

A

Re-executing prior unit tests after a change to ensure old fixed bugs are still fixed.

17
Q

What is Test-Driven Development (TDD)?

A

A process that starts with designing and developing tests for every small functionality of an application before writing the code.

18
Q

What is the TDD cycle?

A

Write a test, make it run, change code to make it right (refactor), repeat process.

19
Q

What is the importance of naming test cases descriptively?

A

Clear, long, descriptive names help identify what the test is checking.

20
Q

What are breakpoints in debugging?

A

Lines of code where you want to ‘pause’ the execution of a program.

21
Q

What does the continue feature do in debugging?

A

Continues the execution of the program until the next breakpoint or until the program terminates.

22
Q

What is a call stack?

A

Allows you to see the current stack of method calls.

23
Q

What is the purpose of the watches window in debugging?

A

Allows you to ‘watch’ the value of a variable.

24
Q

Fill in the blank: A bug can be ______ or can hide in your code until much later.

25
True or False: Unit testing is looking for errors in a subsystem in isolation.
True
26
What is the purpose of setup and teardown methods in JUnit?
To run code before and after each test case method is called.
27
What happens if a method with @Test does not finish running within the specified timeout?
The method will be considered a failure.
28
What should tests avoid to be trustworthy?
Logic, such as if/else statements, loops, and try/catch.
29
What is the main goal of regression testing?
To ensure that a feature that used to work, no longer works due to code changes.
30
What does JUnit provide to help write tests?
Assert commands to check expectations in test methods.