SlideShare a Scribd company logo
Squish Coco
Why Squish Coco?
● Typical question: Are we testing enough? Are we testing the right
things?
● Answer: Code coverage analysis
– Understand which tests excercise which source code
– Understand which tests are redundant
– Discover testing gaps
– More advanced analysis
Squish Coco
● Cross-Plattform Code Coverage Analysis
– Windows, Linux, macOS, Unix, RTOSes
– C, C++, C#, SystemC, Tcl, QML
● Coverage Levels
– Function
– Statement
– Branch (Decision)
– Condition
– Condition/Decision
– MC/DC
– MCC
Coco Agenda
Basics
●
Available coverage metrics
●
Supported platforms
●
Architecture, data formats
●
Approaches to instrumentation
●
Impact on build and execution
Live Demos
●
Interactive analysis via GUI
●
Report generation via command line
●
Overview of result formats
●
Manual validation
●
Analysis: optimzed execution order,
execution comparison, patch review
Integrations
●
Command line tools
●
Unit tests
●
CI systems
●
Build system
Discussion
●
Question and answers
●
Requirements
Coverage Analysis (Example)
Coverage Levels – Function
int f(unsigned int a, unsigned int b, int c) {
int x = 0;
if ((a != 0 || b != 0) && c != 0)
x = a*b / c / max(a, b);
return x;
}
Test
f(0, 1, 1)
Coverage Levels – Line
int f(unsigned int a, unsigned int b, int c) {
int x = 0;
if ((a != 0 || b != 0) && c != 0)
x = a*b / c / max(a, b);
return x;
}
Test
f(0, 1, 1)
Coverage Levels – Statement
int f(unsigned int a, unsigned int b, int c) {
int x = 0;
if ((a != 0 || b != 0) && c != 0)
x = a*b / c / max(a, b);
return x;
}
Test
f(0, 1, 1)
Coverage Levels – Decision / Branch
int f(unsigned int a, unsigned int b, int c) {
int x = 0;
if ((a != 0 || b != 0) && c != 0)
x = a*b / c / max(a, b);
return x;
}
Test (X || Y) && Z Decision
f(0, 1, 1) (FALSE || TRUE) && TRUE TRUE
f(0, 0, 1) (FALSE || FALSE) && …. FALSE
Coverage Levels – Condition
int f(unsigned int a, unsigned int b, int c) {
int x = 0;
if ((a != 0 || b != 0) && c != 0)
x = a*b / c / max(a, b);
return x;
}
Test a != 0 b != 0 c != 0
f(1, 1, 0) TRUE - FALSE
f(0, 1, 1) FALSE TRUE TRUE
f(0, 0, 0) FALSE FALSE -
Coverage Levels – MCC
bool isValidPosition(int x, int y, int z)
{
if ((x > 10 || y > 20) && z > 0)
return true;
else
return false;
}
x > 10 y > 20 z > 0
FALSE TRUE TRUE
TRUE - TRUE
FALSE TRUE FALSE
TRUE - FALSE
FALSE FALSE -
Coverage Levels – MCC #2
bool isSilentSignal(int *line1, int *line2)
{
if ((!line1 || *line1 <= 0) && (!line2 || *line2 <= 0))
return true;
else
return false;
}
!line1 *line1 <= 0 !line2 *line2 <= 0
TRUE - FALSE TRUE
TRUE - FALSE FALSE
FALSE TRUE TRUE -
TRUE - TRUE -
FALSE FALSE - -
FALSE TRUE FALSE TRUE
FALSE TRUE FALSE FALSE
Modified Condition / Decision Coverage
“Every point of entry and exit in the program has been invoked at least once, every
condition in a decision in the program has taken all possible outcomes at least once, and
each condition has been shown to affect that decision outcome independently. A condition
is shown to affect a decision's outcome independently by varying just that condition while
holding fixed all other possible conditions.”
(Formal definition DO-178C)
Coverage Levels – MC/DC
bool isSilentSignal(int *line1, int *line2)
{
if ((!line1 || *line1 <= 0) && (!line2 || *line2 <= 0))
return true;
else
return false;
}
!line1 *line1 <= 0 !line2 *line2 <= 0 Decision
TRUE - FALSE TRUE TRUE
TRUE - FALSE FALSE FALSE
FALSE TRUE TRUE - TRUE
TRUE - TRUE - TRUE
FALSE FALSE - - FALSE
Supported Platforms
Operating systems
● Windows
●
Linux
●
Mac OS X
● Solaris
●
Embedded / RTOS
Programming languages
●
C and C++
●
SystemC
●
C# (Microsoft and Mono)
●
QML
●
Tcl
●
Planned: Java, JavaScript
Architecture
Instrumentation Database
Architecture
Report Generation
Architecture
Regular Product Build
Architecture
Regular Source Compilation
Architecture
Source Instrumentation
Architecture
Instrumentation Linking
Architecture
Alternative to build system change:
● Make use of fake cl.exe and link.exe
● Set PATH to override originals
● Set COVERAGESCANNER_ARGS=--cs-on
Instrumentation Types
●
Source code insertion at compile time
●
Pro: highest possible coverage type
●
Drawback: increased binary size
●
Binary instrumentation at runtime
●
Pro: No recompilation necessary
●
Con: Limited coverage type
●
Con: Less portable
●
Con: wrong results with optimized builds
Instrumentation Overhead
Impact on:
●
Compilation time
●
Binary size
●
Execution time
Influencing factors:
●
Coverage level
●
Optimization level
Live Demo
Report Generation
Command line version:
cmreport --title="Coverage Results"
--csmes=parser.exe.csmes
--select=".*"
--bargraph --toc
--global=all --method=all --source=all
--execution=all
--html=result.html
Additional options: HTML style, watermarks, coverage level, ...
Report Generation
Available formats:
●
HTML (stylable)
●
XML (basic, EMMA)
●
JUnit
●
CSV
●
Text (line format)
●
Cobertura (for SonarQube)
Manual Validation
How to deal with code hard/impossible to automatically cover?
●
Source code annotations
●
Pro: robust
●
Drawback: invasive
●
Example: /* coco validated: only for debugging */
●
Result amendments
●
Pro: product untouched
●
Con: possibly fragile on code changes
Command Line Tools
Execution import via cmcsexeimport:
Command Line Tools
Database merge via cmmerge:
Integration
System test with “dump on exit”:
Integration
Monitor long-running process with “dump on event”:
Integration
Force dump with API calls:
Integration
Control API (guard with #ifdef __COVERAGESCANNER__):
__coveragescanner_testname(const char *name)
__coveragescanner_teststate(const char *state)
__coveragescanner_add_html_comment(const char *comment)
__coveragescanner_save()
__coveragescanner_filename(const char *name)
__coveragescanner_set_custom_io(.....)
Pragmas:
#pragma CoverageScanner(cov-on)
#pragma CoverageScanner(cov-off)
Unit Test Integration
Basic integration
● Rely on “dump on exit”
● Make use of cmcsexeimport, cmmerge and cmreport
Advanced integration
● Set __coveragescanner_test_name()
● Transport __coveragescanner_test_state()
● Add __coveragescanner_html_comment()
● Segment with __coveragescanner_save()
Unit Test Integration (Qt)
Usage in QTestLib:
● Test build, execution and coverage as single step
●
Associate test run and result with respective coverage
...
void MyUnitTest::cleanup()
{
cleanupTest();
#ifdef __COVERAGESCANNER__
QString test_name="unittest/";
test_name += metaObject()->className();
test_name += "/";
test_name += QTest::currentTestFunction();
__coveragescanner_testname(test_name.toLatin1());
if (QTest::currentTestFailed())
__coveragescanner_teststate("FAILED");
else
__coveragescanner_teststate("PASSED") ;
__coveragescanner_save();
#endif
}
Test Framework Integration
●
Continuous Integration (CI):
●
Jenkins
●
Bamboo
●
CruiseControl
●
SonarQube
●
Hooks in revision control system
Open Coverage Service
Code Metrics
Tool Qualification Kit
Thank you!

More Related Content

PDF
Squish slidedeck
PPTX
Jenkins tutorial for beginners
PPTX
Jenkins CI presentation
ODP
Test Automation Framework using Cucumber BDD overview (part 1)
PDF
SonarQube - Should I Stay or Should I Go ?
PDF
Basic Kong API Gateway
PDF
Postman: An Introduction for API Ops Professionals
PPTX
Understanding Unit Testing
Squish slidedeck
Jenkins tutorial for beginners
Jenkins CI presentation
Test Automation Framework using Cucumber BDD overview (part 1)
SonarQube - Should I Stay or Should I Go ?
Basic Kong API Gateway
Postman: An Introduction for API Ops Professionals
Understanding Unit Testing

What's hot (20)

PDF
froglogic Squish GUI Tester Presentation
PDF
CICD Using CircleCI
PPTX
Setting Up CircleCI Workflows for Your Salesforce Apps
PPT
Selenium ppt
PPT
Test Automation With Cucumber JVM, Selenium, and Mocha
PPTX
The tests are trying to tell you something@VoxxedBucharest.pptx
PPTX
Jenkins CI
PDF
Jenkins
PDF
Robot framework 을 이용한 기능 테스트 자동화
PDF
Inverting The Testing Pyramid
PDF
The story of SonarQube told to a DevOps Engineer
PPTX
Beautfiul world of Flutter Testing
PPT
Présentation Tests Fonctionnels
PDF
Test and Behaviour Driven Development (TDD/BDD)
PPTX
Framework For Automation Testing Practice Sharing
PDF
An introduction to Google test framework
PDF
Automotive embedded systems part6 v1
PDF
PPTX
Introducción a Wiremock
froglogic Squish GUI Tester Presentation
CICD Using CircleCI
Setting Up CircleCI Workflows for Your Salesforce Apps
Selenium ppt
Test Automation With Cucumber JVM, Selenium, and Mocha
The tests are trying to tell you something@VoxxedBucharest.pptx
Jenkins CI
Jenkins
Robot framework 을 이용한 기능 테스트 자동화
Inverting The Testing Pyramid
The story of SonarQube told to a DevOps Engineer
Beautfiul world of Flutter Testing
Présentation Tests Fonctionnels
Test and Behaviour Driven Development (TDD/BDD)
Framework For Automation Testing Practice Sharing
An introduction to Google test framework
Automotive embedded systems part6 v1
Introducción a Wiremock
Ad

Similar to froglogic Coco Code Coverage Presentation (20)

PDF
Taming event-driven software via formal verification
PPT
Software testing strategies
PDF
C++ and OOPS Crash Course by ACM DBIT | Grejo Joby
PDF
Presentation slides: "How to get 100% code coverage"
PPTX
C Programming Language Tutorial for beginners - JavaTpoint
PDF
MASTER-CLASS: "CODE COVERAGE ON Μ-CONTROLLER" Sebastian Götzinger
PPT
Unit1 C
PPT
Unit1 C
PPTX
Introduction to code optimization by dipankar
PPTX
Code optimization
PPTX
Code optimization
PPT
Unit 1 c - all topics
PPT
Coding style for good synthesis
PPTX
Combining Phase Identification and Statistic Modeling for Automated Parallel ...
PDF
Refactoring & Restructuring - Improving the Code and Structure of Software
PPT
Cbasic
PPTX
Programming in C Basics
PDF
"Test Design Techniques"
PPTX
CodeChecker summary 21062021
PDF
Exploiting vectorization with ISPC
Taming event-driven software via formal verification
Software testing strategies
C++ and OOPS Crash Course by ACM DBIT | Grejo Joby
Presentation slides: "How to get 100% code coverage"
C Programming Language Tutorial for beginners - JavaTpoint
MASTER-CLASS: "CODE COVERAGE ON Μ-CONTROLLER" Sebastian Götzinger
Unit1 C
Unit1 C
Introduction to code optimization by dipankar
Code optimization
Code optimization
Unit 1 c - all topics
Coding style for good synthesis
Combining Phase Identification and Statistic Modeling for Automated Parallel ...
Refactoring & Restructuring - Improving the Code and Structure of Software
Cbasic
Programming in C Basics
"Test Design Techniques"
CodeChecker summary 21062021
Exploiting vectorization with ISPC
Ad

Recently uploaded (20)

PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
Introduction to Artificial Intelligence
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
history of c programming in notes for students .pptx
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
System and Network Administration Chapter 2
PDF
Digital Strategies for Manufacturing Companies
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Understanding Forklifts - TECH EHS Solution
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
L1 - Introduction to python Backend.pptx
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
wealthsignaloriginal-com-DS-text-... (1).pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Introduction to Artificial Intelligence
Wondershare Filmora 15 Crack With Activation Key [2025
How to Migrate SBCGlobal Email to Yahoo Easily
history of c programming in notes for students .pptx
Odoo POS Development Services by CandidRoot Solutions
Odoo Companies in India – Driving Business Transformation.pdf
System and Network Administration Chapter 2
Digital Strategies for Manufacturing Companies
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Understanding Forklifts - TECH EHS Solution
2025 Textile ERP Trends: SAP, Odoo & Oracle
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
VVF-Customer-Presentation2025-Ver1.9.pptx
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
L1 - Introduction to python Backend.pptx
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf

froglogic Coco Code Coverage Presentation

  • 2. Why Squish Coco? ● Typical question: Are we testing enough? Are we testing the right things? ● Answer: Code coverage analysis – Understand which tests excercise which source code – Understand which tests are redundant – Discover testing gaps – More advanced analysis
  • 3. Squish Coco ● Cross-Plattform Code Coverage Analysis – Windows, Linux, macOS, Unix, RTOSes – C, C++, C#, SystemC, Tcl, QML ● Coverage Levels – Function – Statement – Branch (Decision) – Condition – Condition/Decision – MC/DC – MCC
  • 4. Coco Agenda Basics ● Available coverage metrics ● Supported platforms ● Architecture, data formats ● Approaches to instrumentation ● Impact on build and execution Live Demos ● Interactive analysis via GUI ● Report generation via command line ● Overview of result formats ● Manual validation ● Analysis: optimzed execution order, execution comparison, patch review Integrations ● Command line tools ● Unit tests ● CI systems ● Build system Discussion ● Question and answers ● Requirements
  • 6. Coverage Levels – Function int f(unsigned int a, unsigned int b, int c) { int x = 0; if ((a != 0 || b != 0) && c != 0) x = a*b / c / max(a, b); return x; } Test f(0, 1, 1)
  • 7. Coverage Levels – Line int f(unsigned int a, unsigned int b, int c) { int x = 0; if ((a != 0 || b != 0) && c != 0) x = a*b / c / max(a, b); return x; } Test f(0, 1, 1)
  • 8. Coverage Levels – Statement int f(unsigned int a, unsigned int b, int c) { int x = 0; if ((a != 0 || b != 0) && c != 0) x = a*b / c / max(a, b); return x; } Test f(0, 1, 1)
  • 9. Coverage Levels – Decision / Branch int f(unsigned int a, unsigned int b, int c) { int x = 0; if ((a != 0 || b != 0) && c != 0) x = a*b / c / max(a, b); return x; } Test (X || Y) && Z Decision f(0, 1, 1) (FALSE || TRUE) && TRUE TRUE f(0, 0, 1) (FALSE || FALSE) && …. FALSE
  • 10. Coverage Levels – Condition int f(unsigned int a, unsigned int b, int c) { int x = 0; if ((a != 0 || b != 0) && c != 0) x = a*b / c / max(a, b); return x; } Test a != 0 b != 0 c != 0 f(1, 1, 0) TRUE - FALSE f(0, 1, 1) FALSE TRUE TRUE f(0, 0, 0) FALSE FALSE -
  • 11. Coverage Levels – MCC bool isValidPosition(int x, int y, int z) { if ((x > 10 || y > 20) && z > 0) return true; else return false; } x > 10 y > 20 z > 0 FALSE TRUE TRUE TRUE - TRUE FALSE TRUE FALSE TRUE - FALSE FALSE FALSE -
  • 12. Coverage Levels – MCC #2 bool isSilentSignal(int *line1, int *line2) { if ((!line1 || *line1 <= 0) && (!line2 || *line2 <= 0)) return true; else return false; } !line1 *line1 <= 0 !line2 *line2 <= 0 TRUE - FALSE TRUE TRUE - FALSE FALSE FALSE TRUE TRUE - TRUE - TRUE - FALSE FALSE - - FALSE TRUE FALSE TRUE FALSE TRUE FALSE FALSE
  • 13. Modified Condition / Decision Coverage “Every point of entry and exit in the program has been invoked at least once, every condition in a decision in the program has taken all possible outcomes at least once, and each condition has been shown to affect that decision outcome independently. A condition is shown to affect a decision's outcome independently by varying just that condition while holding fixed all other possible conditions.” (Formal definition DO-178C)
  • 14. Coverage Levels – MC/DC bool isSilentSignal(int *line1, int *line2) { if ((!line1 || *line1 <= 0) && (!line2 || *line2 <= 0)) return true; else return false; } !line1 *line1 <= 0 !line2 *line2 <= 0 Decision TRUE - FALSE TRUE TRUE TRUE - FALSE FALSE FALSE FALSE TRUE TRUE - TRUE TRUE - TRUE - TRUE FALSE FALSE - - FALSE
  • 15. Supported Platforms Operating systems ● Windows ● Linux ● Mac OS X ● Solaris ● Embedded / RTOS Programming languages ● C and C++ ● SystemC ● C# (Microsoft and Mono) ● QML ● Tcl ● Planned: Java, JavaScript
  • 22. Architecture Alternative to build system change: ● Make use of fake cl.exe and link.exe ● Set PATH to override originals ● Set COVERAGESCANNER_ARGS=--cs-on
  • 23. Instrumentation Types ● Source code insertion at compile time ● Pro: highest possible coverage type ● Drawback: increased binary size ● Binary instrumentation at runtime ● Pro: No recompilation necessary ● Con: Limited coverage type ● Con: Less portable ● Con: wrong results with optimized builds
  • 24. Instrumentation Overhead Impact on: ● Compilation time ● Binary size ● Execution time Influencing factors: ● Coverage level ● Optimization level
  • 26. Report Generation Command line version: cmreport --title="Coverage Results" --csmes=parser.exe.csmes --select=".*" --bargraph --toc --global=all --method=all --source=all --execution=all --html=result.html Additional options: HTML style, watermarks, coverage level, ...
  • 27. Report Generation Available formats: ● HTML (stylable) ● XML (basic, EMMA) ● JUnit ● CSV ● Text (line format) ● Cobertura (for SonarQube)
  • 28. Manual Validation How to deal with code hard/impossible to automatically cover? ● Source code annotations ● Pro: robust ● Drawback: invasive ● Example: /* coco validated: only for debugging */ ● Result amendments ● Pro: product untouched ● Con: possibly fragile on code changes
  • 29. Command Line Tools Execution import via cmcsexeimport:
  • 30. Command Line Tools Database merge via cmmerge:
  • 31. Integration System test with “dump on exit”:
  • 32. Integration Monitor long-running process with “dump on event”:
  • 34. Integration Control API (guard with #ifdef __COVERAGESCANNER__): __coveragescanner_testname(const char *name) __coveragescanner_teststate(const char *state) __coveragescanner_add_html_comment(const char *comment) __coveragescanner_save() __coveragescanner_filename(const char *name) __coveragescanner_set_custom_io(.....) Pragmas: #pragma CoverageScanner(cov-on) #pragma CoverageScanner(cov-off)
  • 35. Unit Test Integration Basic integration ● Rely on “dump on exit” ● Make use of cmcsexeimport, cmmerge and cmreport Advanced integration ● Set __coveragescanner_test_name() ● Transport __coveragescanner_test_state() ● Add __coveragescanner_html_comment() ● Segment with __coveragescanner_save()
  • 36. Unit Test Integration (Qt) Usage in QTestLib: ● Test build, execution and coverage as single step ● Associate test run and result with respective coverage ... void MyUnitTest::cleanup() { cleanupTest(); #ifdef __COVERAGESCANNER__ QString test_name="unittest/"; test_name += metaObject()->className(); test_name += "/"; test_name += QTest::currentTestFunction(); __coveragescanner_testname(test_name.toLatin1()); if (QTest::currentTestFailed()) __coveragescanner_teststate("FAILED"); else __coveragescanner_teststate("PASSED") ; __coveragescanner_save(); #endif }
  • 37. Test Framework Integration ● Continuous Integration (CI): ● Jenkins ● Bamboo ● CruiseControl ● SonarQube ● Hooks in revision control system