Unit Testing With VectorCAST And AUTOSAR - Vector Group

Transcription

Unit Testing with VectorCAST and AUTOSARVector TechDay – Software Testing with VectorCASTV1.0 2018-11-15

AgendauIntroductionUnit Testing DemoWorking with AUTOSAR Generated CodeUnit Testing AUTOSAR SWCsConclusions2

IntroductionTypes of Testing3Unit TestingIntegration TestingIndividual units or modules aretested. It involves testing of sourcecode by developers.Individual modules are groupedtogether and tested. The purpose isto determine that modules areworking as expected once they areintegrated.System TestingTesting is performed on the wholesystem by checking whether thesystem or application meets therequirement specificationdocument.

IntroductionHow Does Unit Testing Work?Source CodeTest HarnessTestDriverUnit(s)RealUnder TestDependents(.obj files)Unit(s)Under TestStubbedDependents4

IntroductionWhat is VectorCAST?ALMRequirements GatewayAnalysisMetrics inuousIntegrationSystem TestCode CoverageUnit TestStaticAnalysisCompiler, Debugger,RTOS, Simulator5Technical DebtLegacy Testing

IntroductionHow Does VectorCAST Help You?Time to TestWeeksMinutesFrequency of TestPer ReleasePer ChangeWho Runs TestsQAEveryoneLevel of AutomationManual6Automatic

IntroductionHow Does VectorCAST Enable Unit Testing?uCreates an automated and repeatableprocess for developersuAutomatically generates your Test Harnessincluding Smart StubsuProvides an intuitive user interface forgenerating test casesuContains a Command Line Interface (CLI)for headless test executionuSupports C, C , and ureIntegration TestingSystemUnitDesignTestingCoding7

IntroductionVectorCAST Enables Multi-Target Testing?Source CodeHost Environmentparse rawVectorCAST RSPsource codeTest HarnessTarget/SimulatorExecuteTestsauto generateall driversand stubsTestReportsTestsPASSFAILPASSPass/Fail ResultsPASSandEthernet, Serial Link, JTAG100% Coverage8Code Coverage

IntroductionVectorCAST Supports Your Embedded Tool ChainuPush button on-target and simulatortest executionuBuilt-in support for more than 30compiler familiesu Hundreds of chip and runtimecombinationsuFull-featured integrations with:u Cross Compiler Language Extensionsu Embedded Debuggersu JTAG Probesu Real-Time Operating SystemsQWhat do all these companies have in common?ANone of these companies offer a test automation platform.VectorCAST provides test automation to all of these environments.9

IntroductionWhat is AUTOSAR?Learn More About AUTOSARhttps://www.autosar.org/10

IntroductionAUTOSAR PartnersCore PartnersDevelopment PartnersAssociate PartnersAttendeesPremium PartnersVector Informatik GmbHGenericTIER 111StandardSoftwareTools andServicesSemiconductor

IntroductionAutomotive TrendsCloud / BackendEmbedded SystemsAUTOSAR Classic12usupport of high performance processorsuhigh bandwidthuservice based architecturesuopen source, agile developmentudynamic and updatableuinternetusafeusecureuembedded integration and debugginguautomotive supply chainuautomotive communication protocolsuautomotive diagnostics

IntroductionAdaptive – best of two worldsusupportof high performanceprocessorsAdaptiveAUTOSAR system and mobility strategiesuhigh bandwidth deep learninguservice based architecturesuopen source, agile developmentudynamic and updatableuinternetusafeusecure basic functionsuuuuuuuuembedded integration and debuggingsafeautomotive supply chainsecureautomotive communication protocolsembedded integration and debuggingautomotive diagnosticsautomotive supply chain fallback computinguautomotive communication protocolsuautomotive diagnosticsCloud / BackendOn board Supercomputers multipurpose computing servers connectivity, gateways, HMI automated drivingmastered by OEMAUTOSAR AdaptiveEmbedded Systems intelligent sensors and actuatorsAUTOSAR Classic13

IntroductionBeing Prepared for the Next-Generation of ECUsAdaptive MICROSAR is acomplete basic softwaresolution up to ASIL DAdditional, highperformance ECUshosting applications forupcoming use casesApplications installed andstarted during runtimeDevelopment ofapplications in theecosystem of POSIXbased OS (Linux, PikeOS,QNX, Integrity, )14Seamlessinteroperability withclassic AUTOSAR ECUsInfotainmentsource: fotoliaADASConnectivityDynamic Software Platform

IntroductionAUTOSAR Product ComparisonAUTOSAR Classic Platform - onentAUTOSAR InterfaceAUTOSAR InterfaceApplication LayerAUTOSAR Adaptive Platform - entSWCSWCAUTOSAR InterfaceAUTOSAR mentAPIAPIRuntime EnvironmentSystem ServicesMemoryServicesCommunicationServicesI/O HardwareAbstractionOnboard temBootloaderMicrocontrollerDriversMemory DriversCommunicationDriversI/O DriversAUTOSARRuntime Environmentfor Adaptive ApplicationsSWCARAAdaptive AUTOSAR IAPIAPIAPIPlatformHealthManagementLogging entAdaptive AUTOSAR Foundation(Virtual) Machine / HardwareMicrocontrollerReal Time RequirementsSafety CriticalComputing Power15

AgendaIntroductionuUnit Testing DemoWorking with AUTOSAR Generated CodeUnit Testing AUTOSAR SWCsConclusions16

Unit Testing DemoComplete Ethernet DemoThe demo has several ECUs with differenttasks. The central ECU is MyECU. MyECU isconnected to one Ethernet channel Ethernet1and to two CAN channels CAN1 and CAN2. Oneach CAN channel there are two ECUsconnected, USDnode01, USDnode02 on CAN1and USDnode03, USDnode04 on CAN2.On Ethernet side there are seven further ECUsdesigned for the different demo cases.17uDownloadUDSnode01 toDownloadUDSnode04 are used for flashsimulation of UDSnodes0x on CANuTimeSync being the Slave node to receivesynchronized global time from MyECUuAvTPAudio to show AVB behavioruTerminal for the SOME/IP demo.

Unit Testing DemoFocus on MyECUMyECU is the central ECU of the EthernetDemo. It is running MICROSAR4 BSW andimplements following functionality:18uProvider of SOME/IP servicesu Maths including methods Add, Divide,Multiply and Subtract as well as theevent Triangle. These methodsimplement a simple version of acalculator, and the event generates atriangle signal.uMany additional included features notdescribed here

Unit Testing DemoTest the SOME/IP Math Serviceu19We will select the AUTOSARSoftware Component (SWC)SWC service Math Server.c fromthe application source folder to unittest

Unit Testing DemoSample function to be tested20

Unit Testing DemoCreate Requirementsu21SOME/IP Maths Requirements:

AgendaIntroductionUnit Testing DemouWorking with AUTOSAR Generated CodeUnit Testing AUTOSAR SWCsConclusions22

Working with AUTOSAR Generated CodeWhat do I Unit Test?uMost of the time your Application SWCsuPossibly Complex Device Drivers (CDDs) or Microcontroller Abstraction Layer (MCAL) DriversuMaybe custom BSW componentsAUTOSAR Classic Platform - onentAUTOSAR InterfaceAUTOSAR InterfaceApplication LayerAUTOSAR Adaptive Platform - entSWCSWCAUTOSAR InterfaceAUTOSAR mentAPIAPIRuntime EnvironmentSystem ServicesMemoryServicesCommunicationServicesI/O HardwareAbstractionOnboard temBootloaderMicrocontrollerDriversMemory DriversCommunicationDriversMicrocontroller23I/O DriversAUTOSARRuntime Environmentfor Adaptive ApplicationsSWCARAAdaptive AUTOSAR IAPIAPIAPIPlatformHealthManagementLogging entAdaptive AUTOSAR Foundation(Virtual) Machine / Hardware

Working with AUTOSAR Generated CodeTips & Techniquesu24From the Project View right click yourenvironment Properties

Working with AUTOSAR Generated CodeTips & Techniques25uMonitor your build timesuTools Options GUI Message window timestamps

Working with AUTOSAR Generated CodeTips & Techniques26uDisable comments on the Preprocessorcommand for your compileruFor Visual Studio 2013 remove “/C”uOne sample environment reduceu Build time from 9:03 to 6:11 (32%)u Build size from 1.5GB to 322MB (79%)uWhy?u See next slide

Working with AUTOSAR Generated CodeTips & Techniques27uBy design AUTOSAR multiply includes manyheader filesuVectorCAST flattens the include chain during theharness generation processuThis results in very large source filesuUnit testing does not need source codecommentsuUse the Preprocess comment to strip them outuMemMap.h tends to be the biggest contributor

Working with AUTOSAR Generated CodeTips & Techniques28uAUTOSAR Macros such as FUNC,P2VAR, and defines get expandedin the coverage vieweruSource codeuCoverage viewer

AgendaIntroductionUnit Testing DemoWorking with AUTOSAR Generated CodeuUnit Testing AUTOSAR SWCsConclusions29

Unit Testing AUTOSAR SWCsStart with a VectorCAST Projectu30File New VectorCAST Project Empty Project

Unit Testing AUTOSAR SWCsCreate Unit Test Environmentsu31Under Group 1 Create Unit TestEnvironment Interactive

Unit Testing AUTOSAR SWCsImport Requirementsu32In three steps:u Set options, get fieldsuMap attributes tofields, importuView

Unit Testing AUTOSAR SWCsWrite Test Cases33uInsert Test CaseuSet Input & Expected ValuesuExecute

Unit Testing AUTOSAR SWCsIncrease Your Coverage34

Unit Testing AUTOSAR SWCsLink Requirements & Execute Tests35

Unit Testing AUTOSAR SWCsExport Results36

Unit Testing AUTOSAR SWCsWorkflowuStart with a VectorCAST ProjectuCreate Unit Test EnvironmentsuImport RequirementsuWrite Test CasesuIncrease Your CoverageuLink Requirements & Execute TestsuExport ResultsuLive37Demo

ConclusionsDo your AUTOSAR Unit Testing Faster with VectorCAST38uFast building and executing of your unit test harnesses on host or your ECUuQuickly create test cases and increase your test coverage with the GUIuEasy requirement to test case linking and exporting test results

More Information!Visit our Website for: News Products Demo Software Support Workshops Contact Addresseswww.vector.comAuthor:Krueger, KurtVector North America39 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

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