Quality Assurance Flashcards

1
Q

Testing is…

A

show program does what is intended
discover defects before it is put into use
finding differences between expected behaviour and observed behaviour
is aimed at breaking the system
is part of a more general verification and validation process

Testing can reveal the presence of errors - not their absence!

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

Validation

A

Are we developing the right product?

“The assurance that a product, service, or system meets the needs of the customer and other identified stakeholder”

Often involves external stakeholders/customers.

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

Verification

A

Are we developing the product right?

“The evaluation of whether or not a product, service or system complies with regulation, requirement, specification, or imposed condition.”

Often performed as internal procedure.

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

Static analysis

A

Hand execution (reading source code)
Walk-through (informal presentation)
Code inspection (formal presentation)
Automated tools (i.e. in the IDE)

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

Dynamic analysis

A

Black box
White box testing

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

Black-box testing

A

We don’t focus on the program but only input and getting the expected output.

Focus on I/O behaviour. If for any given input we can predict the output, the the unit passes the test. (almost impossible to generate all possible inputs (“test cases”))

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

Equivalence partitioning

A

Done in black-box testing bc there are infinite many possible inputs. A way to reduce the number of test cases by dividing inputs into equivalence classes.

Example: if an object is supposed to accept a negative number, testing one negative number is enough.
Or could be: negative number, 0, positive small number, positive large number

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

White-box testing

A

White box testing is a form of application testing that provides the tester with complete knowledge of the application being tested, including access to source code and design documents.

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

Statement

A

One language construct
‘Line of code” checking true or false

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

Branch

A

Caused by conditions (if, switch, while, etc.)
E.g. A at first choice but not B.

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

Path

A

One potential execution.
E.g. sequence creating A,C

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

Coverage

A

Test quality criteria
Degree to which sum of test cases cover program.
e.g. 75% path coverage

Statement coverage C_0
Branch coverage C_1
Path coverage C_2

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

Statement coverage

A

Basically check all conditions.
Full coverage: every statement executed at least once.

Easy to achieve
reveals unreachable code

C_0 = covered statements / all statements

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

Branch coverage

A

Full coverage == all branches are executed.
For if statement, both then and else part.

Reveals unreachable branches.
Good functional test usually achieves high branch coverage.

C_1 = covered (primitive) branches / all (primitive) branches

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

Path coverage

A

Full coverage == all sequences whose elements relate to directly connected nodes in the control flow graph (potentially infinitely many)
Considers repeated loops.

Theoretically optimal testing strategy but combinatorial explosion.

C_2 = covered execution paths / all execution paths (theoretically)

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

The three different path coverage tests

A

Complete test: all possible paths (generally not possible with loops)
Boundary-Interior Test: Similar to above but loops are executed via special rules (high effort)
Structure test: Similar to above, but loops are executed exactly n-times (high effort)

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

Unit testing

A

Individual components (class or subsystem) are tested.

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

System testing

A

The entire system is tested
Goal: determine if the system meets the requirements (functional and non-functional)

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

Integration testing

A

Groups of subsystems (collections of subsystems) and eventually the entire system are tested.

Goal: test the interfaces among the subsystems. Verify units interacting properly.

20
Q

Acceptance testing

A

Evaluates the system delivered by developers.

Carried out by the client.
Goal: demonstrate that the system meets the requirements and is ready to use.

21
Q

Test driver

A

Simulates part of the system that calls the component under test.
So the driver calls whatever component we are testing.
A component that calls the System Under Test (SUT) or TestedUnit
Often used in Bottom-up integration
Drivers are used to invoking the component that needs to be tested.

22
Q

Test double

A

Used if the collaborator in the system is awkward to work with.
4 types: dummy object, fake object, stub, mock object

22
Q

Test stub

A

simulates a component that is being called by the tested component.

provides/implements the same API as the component
a component, the SUT depends on
returns fake values

23
Q

Dummy object

A

Test double
passed around but never actually used. Usually used to fill parameter lists

24
Q

Fake object

A

Test double
is a working implementation, but usually contains some type of ‘shortcut’.
example: a database stored in memory instead of a real database

25
Q

Stub (test double)

A

Provides canned answers to calls made during the test, but is not able to respond to anything outside what it is programmed for

26
Q

Mock object

A

test double
Mocks are able to mimic the behaviour of a real object. They know how to deal with sequences of call they are expected to receive.

27
Q

Big bang approach

A

Integration test strategy
Test all object at the same time.

28
Q

Bottom up test

A

Integration test strategy
The subsystem in the lowest layer of the call are tested individually.
Then the subsystems above this layer are tested that call the previously tested subsystems. Repeated until all subsystems are included.

29
Q

Top down test

A

Test the subsystems in the top layer first.
Then combine all the subsystems that are called by the tested subsystems and test the resulting collection of subsystems. Do this until all subsystems are incorporated into the tests.

30
Q

Functional testing

A

System test. We want to test the functionality of the system.
Test cases are designed from the requirement analysis document.
System is treated as black box.

31
Q

Performance testing

A

System test
Try to violate non-functional requirements.

I.e. could be test how the system behaves when overloaded. (stress testing)
Try unusual orders of execution.
Check the system’s response to large volumes of data. (volume testing)

Security testing
Recovery testing etc.

32
Q

Alpha testing

A

Acceptance test
Users of software work with the development team to test the software at the developer’s side.

33
Q

Beta testing

A

Acceptance test
A release of the software is made available to users to allow them to experiment and raise problems that they discover with the system developers.

34
Q

Acceptance testing

A

Acceptance test
Customers test a system to decide whether or not it is ready to be accepted from the system developers and deployed in the customer environment. Primarily for custom systems.
Not present in agile processes.

35
Q

When should you write your tests?

A

Traditionally, after the source code is written.
In XP or when using TDD (test-driven development), before the source code is written.

36
Q

Regression testing

A

All tests rerun every time a change is made to the program. Tests must run successfully before the change is committed.

37
Q

How to write one simple test in jUnit.
Testing a method:
public int mul(int x, int y){
// ???
}

A
  1. @Test
  2. Define class, use descriptive name
    public void testMulPositiveNumbersReturnPositive
    In function:
  3. Arrange: Initialise the object you are testing on (unless @BeforeEach)

Calculator c = new Calculator();

  1. act: perform the method

int result = c.mul(2,2);

  1. assert: check if result is expected result

assertEquals(4, result);

38
Q

How to set up several test cases using @BeforeEach.

Testing a method:
public int mul(int x, int y){
// ???
}

A

public class CalculatorTest {
private Calculator c;
@BeforeEach
public void setup(){
c = new Calculator();}
@Test
public void testMul1(){
int result = c.mul(2,2);
assertEquals(4, result);}
}

39
Q

@Test

A

Makes method a test method

40
Q

@BeforeEach

A

Prepare test environment before each test (e.g. load data)

41
Q

@AfterEach

A

Clean up test environment after test.

42
Q

assertEquals([message,], expected, actual)

A

Checks if values are equivalent. Message not necessary.

43
Q

assertTrue([message,],condition)

A

Asserts if the condition is true, if not throws assertionError with the message.
Same for assertFalse, assertFalse, assertNull, assertNotNull

44
Q
A
45
Q
A