unit testing with vectorcast and autosar - assets.vector.com · 3 types of testing introduction...

39
V1.0 | 2018-11-15 Vector TechDay – Software Testing with VectorCAST Unit Testing with VectorCAST and AUTOSAR

Upload: ngotruc

Post on 06-Aug-2019

290 views

Category:

Documents


8 download

TRANSCRIPT

V1.0 | 2018-11-15

Vector TechDay – Software Testing with VectorCAST

Unit Testing with VectorCAST and AUTOSAR

2

u Introduction

Unit Testing Demo

Working with AUTOSAR Generated Code

Unit Testing AUTOSAR SWCs

Conclusions

Agenda

3

Types of Testing

Introduction

System TestingUnit Testing Integration Testing

Individual units or modules are tested. It involves testing of source code by developers.

Individual modules are grouped together and tested. The purpose is to determine that modules are working as expected once they are integrated.

Testing is performed on the whole system by checking whether the system or application meets the requirement specification document.

4

How Does Unit Testing Work?

Introduction

Source Code

Unit(s)

Under Test Real

Dependents

(.obj files)

Stubbed

Dependents

Unit(s)

Under Test

Test Harness

Test

Driver

5

What is VectorCAST?

Introduction

ALMRequirements Gateway

ParallelTesting

AnalysisMetrics Reporting

StaticAnalysis

Model-BasedDevelopment

ContinuousIntegration

Compiler, Debugger,RTOS, Simulator

Technical DebtLegacy Testing

Unit TestCode CoverageSystem Test

6

How Does VectorCAST Help You?

Introduction

Weeks Minutes

Time to Test

Manual Automatic

Level of Automation

Per Release Per Change

Frequency of Test

QA Everyone

Who Runs Tests

7

u Creates an automated and repeatable process for developers

u Automatically generates your Test Harness including Smart Stubs

u Provides an intuitive user interface for generating test cases

u Contains a Command Line Interface (CLI) for headless test execution

u Supports C, C++, and Ada

How Does VectorCAST Enable Unit Testing?

Introduction

Coding

Architecture

Requirements Specification

System

Design

System

Testing

Integration Testing

Unit

Testing

8

VectorCAST Enables Multi-Target Testing?

Introduction

Host Environment Target/Simulator

VectorCAST RSP

Test Harness

Tests

parse raw

source code

auto generate

all drivers

and stubs

PASS

FAIL

PASS

PASS

100% Coverage

Test Reports

Execute

Tests

Pass/Fail Results

and

Code CoverageEthernet, Serial Link, JTAG

Source Code

9

u Push button on-target and simulator test execution

u Built-in support for more than 30 compiler families

u Hundreds of chip and runtime combinations

u Full-featured integrations with:

u Cross Compiler Language Extensions

u Embedded Debuggers

u JTAG Probes

u Real-Time Operating Systems

VectorCAST Supports Your Embedded Tool Chain

Introduction

What do all these companies have in common?

None of these companies offer a test automation platform.

Q

A

VectorCAST provides test automation to all of these environments.

10

What is AUTOSAR?

Introduction

Learn More About AUTOSAR

https://www.autosar.org/

11

AUTOSAR Partners

Introduction

Core Partners

Development Partners

Associate Partners

Premium Partners

Generic TIER 1

Attendees

Tools and Services

Semi-conductor

Standard Software

Vector Informatik GmbH

12

Automotive Trends

Introduction

Cloud / Backend

Embedded Systems

u safe

u secure

u embedded integration and debugging

u automotive supply chain

u automotive communication protocols

u automotive diagnostics

u support of high performance processors

u high bandwidth

u service based architectures

u open source, agile development

u dynamic and updatable

u internet

AUTOSAR Classic

13

u support of high performance processors

u high bandwidth

u service based architectures

u open source, agile development

u dynamic and updatable

u internet

Adaptive AUTOSAR

Adaptive – best of two worlds

Introduction

Cloud / Backend

system and mobility strategies

deep learning

On board Supercomputers

multipurpose computing servers

connectivity, gateways, HMI

automated driving

mastered by OEM

Embedded Systems

intelligent sensors and actuators

basic functions

fallback computing

AUTOSAR Adaptive u safe

u secure

u embedded integration and debugging

u automotive supply chain

u automotive communication protocols

u automotive diagnostics

u safe

u secure

u embedded integration and debugging

u automotive supply chain

u automotive communication protocols

u automotive diagnostics

AUTOSAR Classic

14

Being Prepared for the Next-Generation of ECUs

Introduction

ADAS

Infotainment

source: fotolia

Connectivity

Dynamic Software Platform

Additional, high performance ECUs

hosting applications for upcoming use cases

Adaptive MICROSAR is a complete basic software

solution up to ASIL D

Development of applications in the

ecosystem of POSIX-based OS (Linux, PikeOS,

QNX, Integrity, …)

Seamless interoperability with

classic AUTOSAR ECUs

Applications installed and started during runtime

15

AUTOSAR Classic Platform - CP

AUTOSAR Product Comparison

Introduction

AUTOSAR Adaptive Platform - AP

Application Layer

Runtime Environment

Memory Services

Communication Services

I/O Hardware Abstraction

Complex Drivers

I/O DriversCommunication

DriversMemory Drivers

Microcontroller Drivers

Onboard Device Abstraction

Communication Hardware

Abstraction

Memory Hardware

Abstraction

System Services

Microcontroller

Application Software

Component

AUTOSAR Interface

ActuatorSoftware

Component

AUTOSAR Interface

Sensor Software

Component

AUTOSAR Interface

ApplicationSoftware

Component

AUTOSAR Interface

Adaptive AUTOSAR Foundation

Adaptive AUTOSAR Services

(Virtual) Machine / Hardware

Update Configuration Management

Service

Security Management

Service

Diagnostics

ServiceTime

Management

API

Execution Management

API

Operating System

API

Persistency

API

Bootloader

Platform Health

Management

API

Logging and Tracing

API

Hardware Acceleration

API

Communication Management

API

SWC SWC SWC

ARA ARA ARA

AUTOSAR Runtime Environment

for Adaptive Applications

Real Time Requirements

Computing Power

Safety Critical

16

Introduction

u Unit Testing Demo

Working with AUTOSAR Generated Code

Unit Testing AUTOSAR SWCs

Conclusions

Agenda

17

The demo has several ECUs with different tasks. The central ECU is MyECU. MyECU is connected to one Ethernet channel Ethernet1 and to two CAN channels CAN1 and CAN2. On each CAN channel there are two ECUs connected, USDnode01, USDnode02 on CAN1 and USDnode03, USDnode04 on CAN2.

On Ethernet side there are seven further ECUs designed for the different demo cases.

u DownloadUDSnode01 to DownloadUDSnode04 are used for flash simulation of UDSnodes0x on CAN

u TimeSync being the Slave node to receive synchronized global time from MyECU

u AvTPAudio to show AVB behavior

u Terminal for the SOME/IP demo.

Complete Ethernet Demo

Unit Testing Demo

18

MyECU is the central ECU of the Ethernet Demo. It is running MICROSAR4 BSW and implements following functionality:

u Provider of SOME/IP services

u Maths including methods Add, Divide, Multiply and Subtract as well as the event Triangle. These methods implement a simple version of a calculator, and the event generates a triangle signal.

u Many additional included features not described here…

Focus on MyECU

Unit Testing Demo

19

u We will select the AUTOSAR Software Component (SWC) SWC_service_Math_Server.c from the application source folder to unit test

Test the SOME/IP Math Service

Unit Testing Demo

20

Sample function to be tested

Unit Testing Demo

21

u SOME/IP Maths Requirements:

Create Requirements

Unit Testing Demo

22

Introduction

Unit Testing Demo

u Working with AUTOSAR Generated Code

Unit Testing AUTOSAR SWCs

Conclusions

Agenda

23

u Most of the time your Application SWCs

u Possibly Complex Device Drivers (CDDs) or Microcontroller Abstraction Layer (MCAL) Drivers

u Maybe custom BSW components

What do I Unit Test?

Working with AUTOSAR Generated Code

AUTOSAR Classic Platform - CP AUTOSAR Adaptive Platform - AP

Application Layer

Runtime Environment

Memory Services

Communication Services

I/O Hardware Abstraction

Complex Drivers

I/O DriversCommunication

DriversMemory Drivers

Microcontroller Drivers

Onboard Device Abstraction

Communication Hardware

Abstraction

Memory Hardware

Abstraction

System Services

Microcontroller

Application Software

Component

AUTOSAR Interface

ActuatorSoftware

Component

AUTOSAR Interface

Sensor Software

Component

AUTOSAR Interface

ApplicationSoftware

Component

AUTOSAR Interface

Adaptive AUTOSAR Foundation

Adaptive AUTOSAR Services

(Virtual) Machine / Hardware

Update Configuration Management

Service

Security Management

Service

Diagnostics

ServiceTime

Management

API

Execution Management

API

Operating System

API

Persistency

API

Bootloader

Platform Health

Management

API

Logging and Tracing

API

Hardware Acceleration

API

Communication Management

API

SWC SWC SWC

ARA ARA ARA

AUTOSAR Runtime Environment

for Adaptive Applications

24

u From the Project View right click your environment | Properties

Tips & Techniques

Working with AUTOSAR Generated Code

25

u Monitor your build times

u Tools | Options | GUI | Message window timestamps

Tips & Techniques

Working with AUTOSAR Generated Code

26

u Disable comments on the Preprocessor command for your compiler

u For Visual Studio 2013 remove “/C”

u One sample environment reduce

u Build time from 9:03 to 6:11 (32%)

u Build size from 1.5GB to 322MB (79%)

u Why?

u See next slide

Tips & Techniques

Working with AUTOSAR Generated Code

27

u By design AUTOSAR multiply includes many header files

u VectorCAST flattens the include chain during the harness generation process

u This results in very large source files

u Unit testing does not need source code comments

u Use the Preprocess comment to strip them out

u MemMap.h tends to be the biggest contributor

Tips & Techniques

Working with AUTOSAR Generated Code

28

u AUTOSAR Macros such as FUNC, P2VAR, and defines get expanded in the coverage viewer

u Source code

u Coverage viewer

Tips & Techniques

Working with AUTOSAR Generated Code

29

Introduction

Unit Testing Demo

Working with AUTOSAR Generated Code

u Unit Testing AUTOSAR SWCs

Conclusions

Agenda

30

u File | New | VectorCAST Project | Empty Project

Start with a VectorCAST Project

Unit Testing AUTOSAR SWCs

31

u Under Group_1 | Create Unit Test Environment | Interactive

Create Unit Test Environments

Unit Testing AUTOSAR SWCs

32

Import Requirements

Unit Testing AUTOSAR SWCs

u In three steps:

u Set options, get fields

u Map attributes to fields, import

u View

33

u Insert Test Case

u Set Input & Expected Values

u Execute

Write Test Cases

Unit Testing AUTOSAR SWCs

34

Increase Your Coverage

Unit Testing AUTOSAR SWCs

35

Link Requirements & Execute Tests

Unit Testing AUTOSAR SWCs

36

Export Results

Unit Testing AUTOSAR SWCs

37

u Start with a VectorCAST Project

u Create Unit Test Environments

u Import Requirements

u Write Test Cases

u Increase Your Coverage

u Link Requirements & Execute Tests

u Export Results

uLive Demo

Workflow

Unit Testing AUTOSAR SWCs

38

Conclusions

Do your AUTOSAR Unit Testing Faster with VectorCAST

u Fast building and executing of your unit test harnesses on host or your ECU

u Quickly create test cases and increase your test coverage with the GUI

u Easy requirement to test case linking and exporting test results

39 © 2018. Vector North America Inc. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. V1.0 | 2018-11-15

Author:Krueger, KurtVector North America

More Information!Visit our Website for:> News> Products> Demo Software> Support> Workshops> Contact Addresses

www.vector.com