development testing

82
Development testing Yury Kisliak @ EIS Group

Upload: yury-kisliak

Post on 14-Jan-2017

144 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Development testing

Development testing Yury Kisliak @ EIS Group

Page 2: Development testing

- What is testing- Kinds of testing- Kinds of coverage- Asserts

Page 3: Development testing

What is testing?

Page 4: Development testing

What is testing?

Page 5: Development testing

What is testing?

Page 6: Development testing

What is testing?

Page 7: Development testing

What is testing?

Page 8: Development testing

What is testing?

Page 9: Development testing

What is testing?

Good testing consist of selecting a good set of test inputs and designing a good acceptability checks.

Page 10: Development testing

What is going on when we test?

Page 11: Development testing

What is going on when we test?

-A lot!

Page 12: Development testing

What is going on when we test?

Page 13: Development testing

What is going on when we test?

Page 14: Development testing

What is going on when we test?

Page 15: Development testing

What is going on when we test?

Page 16: Development testing
Page 17: Development testing
Page 18: Development testing
Page 19: Development testing
Page 20: Development testing

Why testing?

- Testing shows presence of defects (but cannot prove that there are no defects).

- Appropriate testing reduces the probability for defects.

Page 21: Development testing

- What is testing- Kinds of testing- Kinds of coverage- Asserts

Page 22: Development testing

Types of testinghttps://en.wikipedia.org/wiki/Software_testing#Testing_types

Page 23: Development testing

Types of testinghttps://en.wikipedia.org/wiki/Software_testing#Testing_types

Page 24: Development testing

Testing Levels

Page 25: Development testing

Testing Levels

Page 26: Development testing

Testing Levels

Page 27: Development testing

Testing Methods

Page 28: Development testing

Testing Methods

Static

- Reviews, walkthroughs, inspections.

- Static program analysis.

Page 29: Development testing

Testing Methods

Static

- Reviews, walkthroughs, inspections.

- Static program analysis.

Dynamic

- Executing programmed code with a given set of test cases

Page 30: Development testing

Testing Methods

Static

- Reviews, walkthroughs, inspections.

- Static program analysis.

Dynamic

- Executing programmed code with a given set of test cases

Black box

- Examining functionality without any knowledge of internal implementation.

White box

- Internal perspective of the system, as well as programming skills, are used to design test cases.

Page 31: Development testing

Testing Methods

Static

- Reviews, walkthroughs, inspections.

- Static program analysis.

Dynamic

- Executing programmed code with a given set of test cases

Black box

- Examining functionality without any knowledge of internal implementation.

White box

- Internal perspective of the system, as well as programming skills, are used to design test cases.

Page 32: Development testing

- What is testing- Kinds of testing- Kinds of coverage- Asserts

Page 33: Development testing

Coverage? What coverage?

Page 34: Development testing

Coverage? What coverage?

Page 35: Development testing

Coverage? What coverage?

Page 36: Development testing

Coverage? What coverage?

Page 37: Development testing

Coverage? What coverage?

Page 38: Development testing

Equivalence partitioning

Page 39: Development testing

Equivalence partitioning

Page 40: Development testing

Equivalence partitioning

Page 41: Development testing

Equivalence partitioning

Page 42: Development testing

Test Coverage

Page 43: Development testing

Test Coverage

Page 44: Development testing

Test Coverage

Page 45: Development testing

Test Coverage

Page 46: Development testing

Test Coverage - is proportion of a program, exercised during testing.

+ gives objective score

+ when coverage is <100%, we are given a meaningful task

- not god in finding “errors of omission”

- difficult to interpret scores <100%

- 100% coverage does mean that all bugs are found

Page 47: Development testing

Coverage metrics

Page 48: Development testing

Coverage metricsHow many coverage metrics are out there?

- A lot!http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

Page 49: Development testing

Coverage metricsHow many coverage metrics are out there?

- A lot!http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

Page 50: Development testing

Coverage metricsStatement (line) coverage: How many coverage metrics

are out there?- A lot!

http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

Page 51: Development testing

Coverage metricsStatement (line) coverage: How many coverage metrics

are out there?- A lot!

http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

100%

Page 52: Development testing

Coverage metricsStatement (line) coverage: How many coverage metrics

are out there?- A lot!

http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

100%

Page 53: Development testing

Coverage metricsStatement (line) coverage: How many coverage metrics

are out there?- A lot!

http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

100% 50%

Page 54: Development testing

Coverage metricsBranch coverage: How many coverage metrics

are out there?- A lot!

http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

Page 55: Development testing

Coverage metricsBranch coverage: How many coverage metrics

are out there?- A lot!

http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

50%

Page 56: Development testing

Coverage metricsBranch coverage: How many coverage metrics

are out there?- A lot!

http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

50% 50%

Page 57: Development testing

Coverage metricsBranch coverage: How many coverage metrics

are out there?- A lot!

http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

50% 50%+ = 100%

Page 58: Development testing

Coverage metrics ✓ Line coverage Branch coverage✓

How many coverage metrics are out there?

- A lot!http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

Loop coverage:

Execute each loop zero, one and more than one times.

Page 59: Development testing

Coverage metrics ✓ Line coverage Branch coverage✓ Loop coverage✓

How many coverage metrics are out there?

- A lot!http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

Modified condition/decision coverage:

MC/DC = branch coverage + conditions takes all possible values + each condition independently affects the outcome of a decision

Page 60: Development testing

Coverage metrics ✓ Line coverage Branch coverage✓ Loop coverage✓

How many coverage metrics are out there?

- A lot!http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

Modified condition/decision coverage:

MC/DC = branch coverage + conditions takes all possible values + each condition independently affects the outcome of a decision

Page 61: Development testing

Coverage metrics ✓ Line coverage Branch coverage✓ Loop coverage✓

How many coverage metrics are out there?

- A lot!http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

Modified condition/decision coverage:

MC/DC = branch coverage + conditions takes all possible values + each condition independently affects the outcome of a decision

a, !b, c => true

Page 62: Development testing

Coverage metrics ✓ Line coverage Branch coverage✓ Loop coverage✓

How many coverage metrics are out there?

- A lot!http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

Modified condition/decision coverage:

MC/DC = branch coverage + conditions takes all possible values + each condition independently affects the outcome of a decision

a, !b, c => true!a, !b, c => false

Page 63: Development testing

Coverage metrics ✓ Line coverage Branch coverage✓ Loop coverage✓

How many coverage metrics are out there?

- A lot!http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

Modified condition/decision coverage:

MC/DC = branch coverage + conditions takes all possible values + each condition independently affects the outcome of a decision

a, !b, c => true!a, !b, c => false!a, b, c => true

Page 64: Development testing

Coverage metrics ✓ Line coverage Branch coverage✓ Loop coverage✓

How many coverage metrics are out there?

- A lot!http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

Modified condition/decision coverage:

MC/DC = branch coverage + conditions takes all possible values + each condition independently affects the outcome of a decision

a, !b, c => true!a, !b, c => false!a, b, c => true!a, b, !c => false

Page 65: Development testing

Coverage metrics ✓ Line coverage Branch coverage✓ Loop coverage✓

How many coverage metrics are out there?

- A lot!http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

Modified condition/decision coverage:

MC/DC = branch coverage + conditions takes all possible values + each condition independently affects the outcome of a decision

a, !b, c => true!a, !b, c => false!a, b, c => true!a, b, !c => false

MC/DC is used in avionics software to ensure adequate testing of the most critical (flight and landing related) parts.

Page 66: Development testing

Coverage metrics ✓ Line coverage Branch coverage✓ Loop coverage✓ MC/DC✓

How many coverage metrics are out there?

- A lot!http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

Path coverage:

Page 67: Development testing

Coverage metrics ✓ Line coverage Branch coverage✓ Loop coverage✓ MC/DC✓

How many coverage metrics are out there?

- A lot!http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

Path coverage:

Page 68: Development testing

Coverage metrics ✓ Line coverage Branch coverage✓ Loop coverage✓ MC/DC✓

How many coverage metrics are out there?

- A lot!http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

Path coverage:

Page 69: Development testing

Coverage metrics ✓ Line coverage Branch coverage✓ Loop coverage✓ MC/DC✓

How many coverage metrics are out there?

- A lot!http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

Path coverage:

Page 70: Development testing

Coverage metrics ✓ Line coverage Branch coverage✓ Loop coverage✓ MC/DC✓ Path coverage✓

How many coverage metrics are out there?

- A lot!http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

What else:

Page 71: Development testing

Coverage metrics ✓ Line coverage Branch coverage✓ Loop coverage✓ MC/DC✓ Path coverage✓

How many coverage metrics are out there?

- A lot!http://www.badsoftware.com/coverage.htm (list of 101 coverage metrics)

How many of them do we need to care about?

- Very few.

What else:

- boundary value coverage- synchronization coverage- … other 94 and more coverages

Page 72: Development testing

How to use coverage

Page 73: Development testing

How to use coverage

Page 74: Development testing

How much testing is enough?

Page 75: Development testing

Tools

Page 76: Development testing

Tools

Page 77: Development testing

- What is testing- Kinds of testing- Kinds of coverage- Asserts

Page 78: Development testing

Assertions

Page 79: Development testing

Assertions

- makes code self-checking, leading to more effective testing

- make code fail early

- document assumptions, preconditions, postconditions and invariants.

- are not for error handling

- must not have side effects

Page 80: Development testing

Assertions

- makes code self-checking, leading to more effective testing

- make code fail early

- document assumptions, preconditions, postconditions and invariants.

- are not for error handling

- must not have side effects

Use error handling code for conditions you expect to occur. Use assertions for conditions that should never occur.

Page 81: Development testing

Assertions

- makes code self-checking, leading to more effective testing

- make code fail early

- document assumptions, preconditions, postconditions and invariants.

- are not for error handling

- must not have side effects

Use error handling code for conditions you expect to occur. Use assertions for conditions that should never occur.

Page 82: Development testing

The end.

Testing by itself does not improve software quality. Test results are an indicator of quality, but in and of themselves they don’t improve it. Trying to improve software quality by increasing the amount of testing is like trying to lose weight by weighing yourself more often. What you eat before you step on to the scale determines how much you will weigh, and the software-develompent techniques you use determine how many errors testing will find. If you want to lose weight, don’t buy a new scale; change your diet. If you want to improve your software, don’t just test more; develop better.

-Steve McConnell