46
Building a safe and secure embedded world Frank Büchner, Hitex GmbH, Karlsruhe Software Unit Verification in IEC 62304

Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

  • Upload
    others

  • View
    20

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Building a safe and secure embedded world

Frank Büchner, Hitex GmbH, Karlsruhe

Software Unit Verificationin IEC 62304

Page 2: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Founded 1976 in Karlsruhe, Germany

Approx. 50 employees

Subsidiary in UK (20 employees)

Part of the Infineon Group since 2003

Tools for safety & security

Test services

Engineering, production, consulting

AURIX preferred design house (PDH)

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 2

Hitex GmbH

Page 3: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Inspiration by a look in non-medical standards

IEC 61508

ISO 26262

DIN EN 50128

ISO 14971

ISO 13485

IEC 60601-1

IEC 61010-1

ISO/IEC 12207

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 3

Motivation

Page 4: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

1. A Look in 62304

2. A Look in Other Standards

2.1 26262 and Code Coverage

2.2 50128 and Independent Testing

2.3 61508 and Software Complexity Control

2.4 26262 and Test Case Specification

2.5 26262 and Tool Qualification

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 4

Contents

Page 5: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Software Unit Verification

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 5

A Look in 62304

IEC 62304:2006+AMD1:2015, p. 24(Copyright der VDE VERLAG GmbH)

DIN EN 62304:2018-06, p. 28(Copyright der VDE VERLAG GmbH)

Page 6: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

What is an unit?

Three criteria

1. Not subdivided / not further decomposed

2. Separately testable

3. Defined by manufacturer

Software item

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 6

A Look in 62304

Page 7: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 7

A Look in 62304

Software Unit

U

U

U U

U

U U

Software System

Software Item

Software Items:

What is an unit?

Page 8: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

What is an unit?

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 8

Conclusion

Programming language Unit

C Function

C++, Java, C#, … Method

Ada Procedure / Function

Second term: verification

Page 9: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Verification

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 9

A Look in 62304

IEC 62304:2006+AMD1:2015, p. 14

Page 10: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Verification

Where do the requirements come from?

Includes

• Requirements Decomposition + Risk Analysis

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 10

A Look in 62304

IEC 62304:2006+AMD1:2015, p. 23

Page 11: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Verification

Strategies, methods, and procedures

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 11

A Look in 62304

IEC 62304:2006+AMD1:2015, p. 24

Page 12: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 12

Excursus

Test

dynamicstatic

manual (by human)

automated (by tool)

automated (by tool)

Page 13: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Verification Acceptance Criteria

Software Unit Acceptance Criteria

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 13

A Look in 62304

IEC 62304:2006+AMD1:2015, p. 19

IEC 62304:2006+AMD1:2015, 5.5.3, p. 24

Page 14: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Requirements

Link Matrix

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 14

Discussion Acceptance Criteria

Page 15: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Interface

Structure

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 15

Discussion Acceptance Criteria

Page 16: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Coding standards (1/2)

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 16

Discussion Acceptance Criteria

IEC 62304:2006+AMD1:2015, p. 49

Page 17: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Coding standards (2/2)

Proprietary coding rules

Ready-made, e.g. MISRA, CERT-C

Checked by static analysis

Preferrably checked by tool

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 17

Discussion Acceptance Criteria

Page 18: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Additional acceptance criteria

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 18

A Look in 62304

IEC 62304:2006+AMD1:2015, p. 24

Page 19: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Proper Event Sequence

E.g. by checking the „Call Trace“

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 19

Discussion Additional Acceptance Criteria

Page 20: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Data flow

A variable can have 3 states:

1. d: defined (= value assigned)

2. r: referenced (= value used)

3. u: undefined (= not initialized)

Three data flow anomalies:

1. ur

2. du

3. dd

A data flow anomaly does not need to result in a failure

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 20

Discussion Additional Acceptance Criteria

Page 21: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Control flow

Example: Unreachable code

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 21

Discussion Additional Acceptance Criteria

Page 22: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Fault handling

Needs requirement

Initialization of variables

This is a data flow anomaly

Self-diagnostic

Needs requirement

Boundary conditions

Relates to test case specification

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 22

Discussion Additional Acceptance Criteria

[ [

Page 23: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

1. A Look in 62304

2. A Look in Other Standards

2.1 26262 and Code Coverage

2.2 50128 and Independent Testing

2.3 61508 and Software Complexity Control

2.4 26262 and Test Case Specification

2.5 26262 and Tool Qualification

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 23

Contents

Page 24: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

62304 mentions

Coverage of requirements

But not code coverage for unit verification

Code coverage in ISO 26262:2011 for Unit Testing

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 24

26262 and Code Coverage

Part 6, Table 12

Page 25: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Recommendation

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 25

26262 and Code Coverage

Safety Class 62304 Coverage Measure

A Statement Coverage

B Branch Coverage

C Modified Condition / Decision Coverage (MC/DC)

Page 26: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

1. A Look in 62304

2. A Look in Other Standards

2.1 26262 and Code Coverage

2.2 50128 and Independent Testing

2.3 61508 and Software Complexity Control

2.4 26262 and Test Case Specification

2.5 26262 and Tool Qualification

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 26

Inhalt

Page 27: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

62304

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 27

50128 and Independent Testing

IEC 62304:2006+AMD1:2015, p. 8

IEC 62304:2006+AMD1:2015, p. 64

Page 28: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

50128 – Bahnanwendungen / Railway

At SIL 0: A person, who is … implementer of a software component must not be tester … of the same software component.

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 28

50128 and Independent Testing

DIN EN 50128:2012-03(Copyright der VDE VERLAG GmbH)

(translation by the author)

Page 29: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Why is independent testing important? (1/3)

Example of a specification

A start value and a length define a range of values. Determine if a given value is within the defined range or not. The end of the range shall not be inside the range. Only integer numbers are to be considered.

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 29

Independent Testing

value

startlength

[ [

outside outsideinside

Page 30: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Why is independent testing important? (2/3)

This case is simple

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 30

Independent Testing

Value = 6 inside!

Start = 5Length= 2

[ [5 6 7

Page 31: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Why is independent testing important? (3/3)

But this case?

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 31

Independent Testing

Value = -6 ???

Start = -5

] ]-7 -6 -5

Length= -2

Page 32: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

1. A Look in 62304

2. A Look in Other Standards

2.1 26262 and Code Coverage

2.2 50128 and Independent Testing

2.3 61508 and Software Complexity Control

2.4 26262 and Test Case Specification

2.5 26262 and Tool Qualification

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 32

Contents

Page 33: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

IEC 61508

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 33

61508 and Software Complexity Control

IEC 61508-3:2010, Table B.9

Page 34: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Metrics for software complexity control

Examples

• Cyclomatic complexity according to McCABE

• Volume according to Halstaed

Tool support necessary!

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 34

61508 and Software Complexity Control

Page 35: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Software module size limit

61508-7, section C.2.9: „typically 2 to 4 screen sizes“

Metric Lines-of-code (LOC)

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 35

61508 and Software Complexity Control

Page 36: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Parameter number limit

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 36

61508 and Software Complexity Control

Page 37: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

One entry / one exit

Rule 15.5 from MISRA-C:2012

• Only one return statement at the end

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 37

61508 and Software Complexity Control

Page 38: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

1. A Look in 62304

2. A Look in Other Standards

2.1 26262 and Code Coverage

2.2 50128 and Independent Testing

2.3 61508 and Software Complexity Control

2.4 26262 and Test Case Specification

2.5 26262 and Tool Qualification

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 38

Contents

Page 39: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

How to find test cases for black-box unit tests?

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 39

26262 and Test Case Specification

ISO 26262:2011, part 6, table 11

Page 40: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Methods from ISO 26262 for deriving test cases

Equivalence classes

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 40

26262 and Test Case Specification

Page 41: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Test case specification using the Classification Tree Method

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 41

Excursus

Page 42: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 42

26262 and Test Case Specification

Methods from ISO 26262 for deriving test cases

Error guessing

aka “intuitive testing”

aka “experienced-based testing”

Page 43: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

1. A Look in 62304

2. A Look in Other Standards

2.1 26262 and Code Coverage

2.2 50128 and Independent Testing

2.3 61508 and Software Complexity Control

2.4 26262 and Test Case Specification

2.5 26262 and Tool Qualification

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 43

Contents

Page 44: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Methods for tool qualification

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 44

26262 and Tool Qualification

ISO 26262:2011, part 8, table 4

Page 45: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Any questions?

Unit test tool TESSY by Razorcat

www.hitex.de/tessy

Static analysis tool KLOCWORK by Roguewave

www.hitex.de/klocwork

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 45

Thank you for listening!

Page 46: Software Unit Verification in IEC 62304 - MedConf · 2018. 11. 29. · Software Unit Verification in IEC 62304 Founded 1976 in Karlsruhe, Germany Approx. 50 employees Subsidiary in

Frank BüchnerDipl.-Inform.Principal Engineer Software Quality

Hitex GmbHGreschbachstr. 12KarlsruheGermany

Tel.: +49 / 721 / 9628 – 125frank.buechner(at)hitex.de

Software Unit Verification, Frank Büchner, Nov. 2018 Copyright © Hitex GmbH 2018. All rights reserved. 46

Contact & Additional Information