SlideShare a Scribd company logo
Copyright © 2017 Crisan Marius Catalin
Agenda
Introduction
What is unit testing?
Test types
Static testing
White box testing
Tool support
Copyright © 2017 Crisan Marius Catalin
Introduction
Who am I?
►ISTQB certified
►Software testing and
development
►More than 2 years working
experience in automotive
area
Copyright © 2017 Crisan Marius Catalin
Introduction
Copyright © 2017 Crisan Marius Catalin
What is a unit?
►software component that contains
one or more routines
►also known as module, component
►all variables and functions from a
module may respect a naming
convention
Software system architecture
Introduction
Copyright © 2017 Crisan Marius Catalin
►A module encapsulates code and data to implement a particular functionality.
MODULE FUNCTIONALITY
Introduction
Copyright © 2017 Crisan Marius Catalin
► All modules together form the
software system.
► The modules communicate
with each other to fulfill the
system requirements.
What is unit testing?
Copyright © 2017 Crisan Marius Catalin
► also known as unit, module or program
testing
► searches for defects in, and verifies the
functioning of, software modules, programs,
objects, classes, etc., that are separately
testable.
What is unit testing?
Copyright © 2017 Crisan Marius Catalin
• lowest level of testing
• tested in isolation
• most through look at detail
• tests are written and run by software
developers
What is unit testing?
Copyright © 2017 Crisan Marius Catalin
Test cases are derived from work products such as:
• specification of the component,
• software design,
• data model.
What is unit testing?
Copyright © 2017 Crisan Marius Catalin
Software development process V-Model
When is unit
testing performed?
What is unit testing?
Copyright © 2017 Crisan Marius Catalin
When is unit testing performed?
Unit testing vs Traditional testing
Copyright © 2017 Crisan Marius Catalin
Traditional Testing
• Test the system as a whole
• Individual components rarely tested
• Errors go undetected
• Source of errors difficult to track down
Unit testing vs Traditional testing
Copyright © 2017 Crisan Marius Catalin
Unit Testing
• Each part tested individually
• All components tested at least once
• Errors picked up earlier
• Scope is smaller, easier to fix errors
Benefits
Copyright © 2017 Crisan Marius Catalin
• Unit testing allows the programmer to refactor code at a
later date, and make sure the module still works correctly.
• By testing the parts of a software application first and then
testing the sum of its parts, integration testing becomes
much easier.
• Unit testing provides a sort of living documentation of the
system.
Test types
Copyright © 2017 Crisan Marius Catalin
A test type is focused on a particular test objective,
which could be any of the following:
►A function to be performed by the software
►A non-functional quality characteristic,
►The structure or architecture of the software,
►Change related.
Component testing include all above.
Functional testing
Copyright © 2017 Crisan Marius Catalin
►is the testing of “what” the system does
►based on functions and features (described in documents or understood
by the testers) and their interoperability
►considers the external behavior of the software (black-box testing)
Functional testing
Copyright © 2017 Crisan Marius Catalin
► security testing:
investigates the functions relating to detection of
threats, such as viruses, from malicious outsiders
► interoperability testing:
evaluates the capability of the software product
to interact with one or more specified
components or systems
Non-functional testing
Copyright © 2017 Crisan Marius Catalin
►is the testing of “how” the system works
►describes the tests required to measure characteristics of systems and
software that can be quantified on a varying scale
►considers the external behavior of the software (black-box testing)
► resource-behavior
e.g. searching for memory leaks
► robustness testing
Structural testing
Copyright © 2017 Crisan Marius Catalin
►based on the structure of code: statement, branch
►measure the thoroughness of testing through assessment of coverage of a
type of structure
►coverage is the extent that a structure has been exercised by a test suite,
expressed as a percentage of the items being covered
►statement coverage
►decision coverage
Testing related to changes
Copyright © 2017 Crisan Marius Catalin
► performed:
- after a defect is detected and fixed,
- when the software, or its environment, is changed.
Regression test suites are strong candidate for automation.
Impact analysis: determine decide how much regression testing
to do
Testing related to changes
Copyright © 2017 Crisan Marius Catalin
► Confirmation testing - confirming that defects have been fixed
BUG FIXED
NEW BUG
NEW BUG
NEW BUG
Re-test
to check
Testing related to changes
Copyright © 2017 Crisan Marius Catalin
► Regression testing - looking for unintended changes
BUG FIXED
NEW BUG
NEW BUG
NEW BUG
Run
regression
Can’t guarantee
to find them all
Static techniques
Copyright © 2017 Crisan Marius Catalin
Static testing techniques rely on the:
► manual examination (reviews)
► automated analysis (static analysis) of the
code or other project documentation
without the execution of the code
Static analysis by tools
Copyright © 2017 Crisan Marius Catalin
►analyze program code (control flow and data
flow), as well as generated output such as
HTML and XML
►early detection of defects prior to test
execution
►identification of defects not easily found by
dynamic testing
Static analysis
Copyright © 2017 Crisan Marius Catalin
►Techniques:
Control flow analysis Data flow analysis
Compliance to standards Calculation of code metrics
Static analysis
Copyright © 2017 Crisan Marius Catalin
Typical defects discovered by static analysis:
 Referencing a variable with an undefined value,
 Variables that are never used,
 Unreachable (dead) code,
 Programming standards violations,
 Security vulnerabilities.
Static analysis
Copyright © 2017 Crisan Marius Catalin
Identify the faults:
White box testing
Copyright © 2017 Crisan Marius Catalin
White Box VS Black Box
Structure-based
techniques
Specification-based
techniques
White box testing
Copyright © 2017 Crisan Marius Catalin
►software testing method in which the internal
structure/design/implementation of the item being tested is known to
the tester
►testing based on an analysis of the internal structure of the component
or system.
►known as clear box testing, glass box testing, transparent box testing
and structural testing
►mainly applied to unit testing
White box testing
Copyright © 2017 Crisan Marius Catalin
White box concepts
White box testing
Copyright © 2017 Crisan Marius Catalin
8 statements branch
branch
condition
decision
Identify the following: statements, decision, condition, branches.
White box testing techniques
►Statement testing
►Decision/branch testing
►Condition testing
►Multiple condition testing
►Condition determination testing
►Loop testing(LCSAJ)
►Path testing
Copyright © 2017 Crisan Marius Catalin
White box testing techniques
1 test is necessary to achieve 100%
statement coverage
Statement testing
Copyright © 2017 Crisan Marius Catalin
Statement coverage is the assessment of the
percentage of executable statements that have been
exercised by a test case suite.
White box testing techniques
Example 1 Example 2
TC Input Statement coverage
Copyright © 2017 Crisan Marius Catalin
White box testing techniques
2 tests are necessary to achieve 100%
branch coverage
Decision/Branch testing
Copyright © 2017 Crisan Marius Catalin
Decision coverage, related to branch testing, is the assessment of
the percentage of decision outcome s (e.g., the True and False
options of an IF statement) that have been exercised by a test case
suite.
White box testing techniques
Example
TC Input Decision coverage
Copyright © 2017 Crisan Marius Catalin
White box testing techniques
? ?
3 tests are necessary to achieve 100%
path coverage
Path testing 1 2 3
Copyright © 2017 Crisan Marius Catalin
►Is a technique in which test cases are designed
to ensure that every path has been traversed at
least once.
White box testing techniques
Example
TC Input Decision coverage
Copyright © 2017 Crisan Marius Catalin
White box testing techniques
Example
Read A
Read B
IF A >= 2 THEN
Print A-B
ELSE
Print A+B
ENDIF
IF B < 5 THEN
Print A*B
ELSE
Print B-A
ENDIF
Minimum number of tests to achieve:
• 100% statement coverage:
• 100% branch coverage:
• 100% path coverage:
2
2
4
Copyright © 2017 Crisan Marius Catalin
White box testing techniques
►Is a technique in which test cases are
designed to execute combinations of
single condition outcomes.
►It requires 𝟐 𝐧
test cases, where n is
the number of conditions, to get 100%
coverage.
2 tests are necessary to achieve 100% multiple
condition coverage
Multiple condition testing
Copyright © 2017 Crisan Marius Catalin
White box testing techniques
Example
If we take the example for above:
We need 8 test cases to get 100% multiple condition coverage.
The test cases we need are:
Copyright © 2017 Crisan Marius Catalin
White box testing techniques
What is a STUB?
• code that simulates the functionality of the
missing components
void functionX()
{
if(boMissingFunction())
/*do something*/
else
/*do something*/
}
....
/*STUB*/
void boMissingFunction()
{
return True;
} Copyright © 2017 Crisan Marius Catalin
White box testing techniques
void CarAlarms()
{
uint8 u8Val=0xFF;
u8Val=CheckDoors();
switch(u8Val):
{
case 0: printf(“Front door open!”); break;
case 1: printf(“Rear door open”); break;
case 2: printf(“Trunk is open!”); break;
case 3: printf(“Hood is open!”); break;
default: /*do nothing*/ break;
}
}
TESTED FUNCTION: CarAlarm()
STUB: CheckDoors()
Copyright © 2017 Crisan Marius Catalin
White box testing techniques
void CarAlarms()
{
/*…*/
u8Val=CheckDoors();
/*…*/
}
bool CheckDoors()
{
return True;
}
TESTED FUNCTION: CarAlarm()
STUB: CheckDoors()
Copyright © 2017 Crisan Marius Catalin
White box testing techniques
What is a DRIVER?
• software component that takes control of
the calling of a function
/*DRIVER*/
void functionThatCallsFunctionX()
{
functionX(100);
}
....
void functionX(uint8 u8Number)
{
/*do something*/
}
Copyright © 2017 Crisan Marius Catalin
White box testing techniques
car
void Engine(bool boIgnition, bool boActualState)
{
if(boActualState == NOT_RUNNING)
if(boIgnition == True)
{
StartEngine();
boActualState = RUNNING;
}
else /*error 1*/
else
if(boIgnition == False)
{
StopEngine();
boActualState = NOT_RUNNING;
}
else /*error 2*/
}
TESTED FUNCTION: Engine()
DRIVER: TEST_Engine()
Copyright © 2017 Crisan Marius Catalin
White box testing techniques
void Engine(bool boIgnition, bool boActualState)
{
/*…*/
}
void TEST_Engine()
{
/*…*/
boIgnition = TRUE;
boActualState = NOT_RUNNING;
Engine(boIgnition, boActualState);
CHECK(boActualState, RUNNING);
/*…*/
}
TESTED FUNCTION: Engine()
DRIVER: TEST_Engine()
Copyright © 2017 Crisan Marius Catalin
White box testing techniques
Test case structure
SET INPUTS
---------------------------------------
CALL FUNCTION
---------------------------------------
CHECK OUTPUT VALUES
TEST CASE BODY
A=2;
B=3;
--------------------------------
S=Sum(A,B);
--------------------------------
CHECK(S,5);
void test_Sum()
Copyright © 2017 Crisan Marius Catalin
White box testing techniques
Test case design approaches:
 Function testing
 Sequence testing
SET INPUTS
---------------------------------------
CALL FUNCTION
---------------------------------------
CHECK OUTPUT VALUES
TEST CASE BODY
SET INPUTS
---------------------------------------
CALL FUNCTION A
CALL FUNCTION B
CALL FUNCTION C
---------------------------------------
CHECK OUTPUT VALUES
TEST CASE BODY
Copyright © 2017 Crisan Marius Catalin
White box testing techniques
Module specification:
• Module is responsible for the sound volume.
• 3 functions are implemented.
SOUND_ENABLE
SET_VOLUME
SOUND_DISABLE
SOUND
How is the module tested?
Copyright © 2017 Crisan Marius Catalin
White box testing techniques
Copyright © 2017 Crisan Marius Catalin
Tool support
Copyright © 2017 Crisan Marius Catalin
► Static Analysis Tools
► Modeling Tools
► Test Harness/Unit Test Framework Tools
► Coverage Measurement Tools
► Dynamic Analysis Tools
Guidelines
Copyright © 2017 Crisan Marius Catalin
► Name tests properly and provide test specification
The typical naming convention is test_[what].
e.g.: test_SaveAs(), test_DeleteProperty()
► Keep tests independent
To ensure testing robustness and simplify maintenance,
tests should never rely on other tests nor should they
depend on the ordering in which tests are executed.
Guidelines
Copyright © 2017 Crisan Marius Catalin
►Unit tests should be fully automated and non-interactive
The test suite is normally executed on a regular basis and must
be fully automated to be useful. If the results require manual
inspection the tests are not proper unit tests.
►Measure the tests
Apply coverage analysis to the test runs so that it is possible to
read the exact execution coverage and investigate which parts
of the code is executed and not.
Guidelines
Copyright © 2017 Crisan Marius Catalin
►Provide negative tests
Negative tests intentionally misuse the code and verify robustness and appropriate error
handling.
►Cover boundary cases
Make sure the parameter boundary cases are covered.
Conclusion
Copyright © 2017 Crisan Marius Catalin
With the help of testing it is possible to measure the quality of the software.
The code can be optimized by revealing hidden errors and being able to remove these
possible defects.
Testing reduces the probability of undiscovered defects remaining in the software.
Any questions?
Copyright © 2017 Crisan Marius Catalin
Copyright © 2017 Crisan Marius Catalin
Continuous learning is the minimum requirement for success in any field. - Brian Tracy
References
Copyright © 2017 Crisan Marius Catalin
1.ISTQB Foundation Level Syllabus 2011
http://www.istqb.org/downloads/syllabi/foundation-level-
syllabus.html
2. Foundations of Software Testing - Rex Black, Erik Van Veenendaal,
Dorothy Graham
3. Guide to Advanced Software Testing - Anne Mette Jonassen Hass
4. Advanced Software Testing(Vol. 3) - Rex Black , Jamie L. Mitchell
5. Images: https://pixabay.com/

More Related Content

What's hot

Unit Testing
Unit TestingUnit Testing
Unit Testing
Anuj Arora
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
Sergey Podolsky
 
Java Unit Testing
Java Unit TestingJava Unit Testing
Java Unit Testing
Nayanda Haberty
 
Unit and integration Testing
Unit and integration TestingUnit and integration Testing
Unit and integration Testing
David Berliner
 
Unit & integration testing
Unit & integration testingUnit & integration testing
Unit & integration testing
Pavlo Hodysh
 
Regression testing
Regression testingRegression testing
Regression testing
Anamta Sayyed
 
Regression testing
Regression testingRegression testing
Regression testing
Harsh verma
 
UNIT TESTING PPT
UNIT TESTING PPTUNIT TESTING PPT
UNIT TESTING PPTsuhasreddy1
 
Unit Test Presentation
Unit Test PresentationUnit Test Presentation
Unit Test PresentationSayedur Rahman
 
Unit testing
Unit testing Unit testing
Unit testing
Mani Kanth
 
Unit Testing (C#)
Unit Testing (C#)Unit Testing (C#)
Unit Testing (C#)
Prashant Cholachagudd
 
Software testing
Software testingSoftware testing
Software testing
Omar Al-Bokari
 
Test cases
Test casesTest cases
Test cases
Chandra Maddigapu
 
Manual testing concepts course 1
Manual testing concepts course 1Manual testing concepts course 1
Manual testing concepts course 1Raghu Kiran
 
Introduction to APIs & how to automate APIs testing with selenium web driver?
Introduction to APIs & how to automate APIs testing with selenium web driver?Introduction to APIs & how to automate APIs testing with selenium web driver?
Introduction to APIs & how to automate APIs testing with selenium web driver?
BugRaptors
 
Unit Tests And Automated Testing
Unit Tests And Automated TestingUnit Tests And Automated Testing
Unit Tests And Automated Testing
Lee Englestone
 
Integration test
Integration testIntegration test
Integration test
sadegh salehi
 
Agile testing
Agile testingAgile testing
Agile testing
Yogita patil
 
Equivalence partitions analysis
Equivalence partitions analysisEquivalence partitions analysis
Equivalence partitions analysis
Vadym Muliavka
 

What's hot (20)

Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Java Unit Testing
Java Unit TestingJava Unit Testing
Java Unit Testing
 
Unit and integration Testing
Unit and integration TestingUnit and integration Testing
Unit and integration Testing
 
Unit & integration testing
Unit & integration testingUnit & integration testing
Unit & integration testing
 
Regression testing
Regression testingRegression testing
Regression testing
 
Regression testing
Regression testingRegression testing
Regression testing
 
UNIT TESTING PPT
UNIT TESTING PPTUNIT TESTING PPT
UNIT TESTING PPT
 
Unit Test Presentation
Unit Test PresentationUnit Test Presentation
Unit Test Presentation
 
Unit testing
Unit testing Unit testing
Unit testing
 
Unit Testing (C#)
Unit Testing (C#)Unit Testing (C#)
Unit Testing (C#)
 
Software testing
Software testingSoftware testing
Software testing
 
Test cases
Test casesTest cases
Test cases
 
Manual testing concepts course 1
Manual testing concepts course 1Manual testing concepts course 1
Manual testing concepts course 1
 
Introduction to APIs & how to automate APIs testing with selenium web driver?
Introduction to APIs & how to automate APIs testing with selenium web driver?Introduction to APIs & how to automate APIs testing with selenium web driver?
Introduction to APIs & how to automate APIs testing with selenium web driver?
 
Unit Tests And Automated Testing
Unit Tests And Automated TestingUnit Tests And Automated Testing
Unit Tests And Automated Testing
 
Black box & white-box testing technique
Black box & white-box testing techniqueBlack box & white-box testing technique
Black box & white-box testing technique
 
Integration test
Integration testIntegration test
Integration test
 
Agile testing
Agile testingAgile testing
Agile testing
 
Equivalence partitions analysis
Equivalence partitions analysisEquivalence partitions analysis
Equivalence partitions analysis
 

Similar to UNIT TESTING

UNIT DEVELOPMENT AND TESTING IN AUTOMOTIVE AREA
UNIT DEVELOPMENT AND TESTING IN AUTOMOTIVE AREAUNIT DEVELOPMENT AND TESTING IN AUTOMOTIVE AREA
UNIT DEVELOPMENT AND TESTING IN AUTOMOTIVE AREA
Marius Crisan
 
QAustral Testing
QAustral   TestingQAustral   Testing
QAustral Testing
cusmaim
 
Risk based regression testing approach
Risk based regression testing approachRisk based regression testing approach
Risk based regression testing approach
Asim Ali
 
Testing
TestingTesting
Testing
Mohammed
 
Cloud Storage Auditing Protocol with Verifiable Outsourcing of Key Updates
Cloud Storage Auditing Protocol with Verifiable Outsourcing of Key UpdatesCloud Storage Auditing Protocol with Verifiable Outsourcing of Key Updates
Cloud Storage Auditing Protocol with Verifiable Outsourcing of Key Updates
IRJET Journal
 
Stress testing of powered by fiware application: the Digital Enabler
Stress testing of powered by fiware application: the Digital EnablerStress testing of powered by fiware application: the Digital Enabler
Stress testing of powered by fiware application: the Digital Enabler
Antonino Sirchia
 
ScioTalks | Coverage Based Testing
ScioTalks | Coverage Based TestingScioTalks | Coverage Based Testing
ScioTalks | Coverage Based Testing
Scio Consulting
 
Writing useful automated tests for the single page applications you build
Writing useful automated tests for the single page applications you buildWriting useful automated tests for the single page applications you build
Writing useful automated tests for the single page applications you build
Andrei Sebastian Cîmpean
 
Testing Interview Questions.pdf
Testing Interview Questions.pdfTesting Interview Questions.pdf
Testing Interview Questions.pdf
PradeepaKannan6
 
The Automation Firehose: Be Strategic and Tactical by Thomas Haver
The Automation Firehose: Be Strategic and Tactical by Thomas HaverThe Automation Firehose: Be Strategic and Tactical by Thomas Haver
The Automation Firehose: Be Strategic and Tactical by Thomas Haver
QA or the Highway
 
unittesting-190620114546 (1).pptx document
unittesting-190620114546 (1).pptx documentunittesting-190620114546 (1).pptx document
unittesting-190620114546 (1).pptx document
AkshayaM79
 
Unit 1 sepm cleanroom engineering
Unit 1 sepm cleanroom engineeringUnit 1 sepm cleanroom engineering
Unit 1 sepm cleanroom engineering
KanchanPatil34
 
Improving your CFML code quality
Improving your CFML code qualityImproving your CFML code quality
Improving your CFML code quality
Kai Koenig
 
Combinatorial testing
Combinatorial testingCombinatorial testing
Combinatorial testing
Kedar Kumar
 
Presentation
PresentationPresentation
PresentationSATYALOK
 
Black & White Box testing
Black & White Box testingBlack & White Box testing
Combinatorial testing ppt
Combinatorial testing pptCombinatorial testing ppt
Combinatorial testing ppt
Kedar Kumar
 
Test strategicaly
Test strategicalyTest strategicaly
Test strategicaly
Erik Lebel
 
PHPUnit - Unit testing
PHPUnit - Unit testingPHPUnit - Unit testing
PHPUnit - Unit testing
Nguyễn Đào Thiên Thư
 
The Role Of The Sqa In Software Development By Jim Coleman
The Role Of The Sqa In Software Development By Jim ColemanThe Role Of The Sqa In Software Development By Jim Coleman
The Role Of The Sqa In Software Development By Jim Coleman
James Coleman
 

Similar to UNIT TESTING (20)

UNIT DEVELOPMENT AND TESTING IN AUTOMOTIVE AREA
UNIT DEVELOPMENT AND TESTING IN AUTOMOTIVE AREAUNIT DEVELOPMENT AND TESTING IN AUTOMOTIVE AREA
UNIT DEVELOPMENT AND TESTING IN AUTOMOTIVE AREA
 
QAustral Testing
QAustral   TestingQAustral   Testing
QAustral Testing
 
Risk based regression testing approach
Risk based regression testing approachRisk based regression testing approach
Risk based regression testing approach
 
Testing
TestingTesting
Testing
 
Cloud Storage Auditing Protocol with Verifiable Outsourcing of Key Updates
Cloud Storage Auditing Protocol with Verifiable Outsourcing of Key UpdatesCloud Storage Auditing Protocol with Verifiable Outsourcing of Key Updates
Cloud Storage Auditing Protocol with Verifiable Outsourcing of Key Updates
 
Stress testing of powered by fiware application: the Digital Enabler
Stress testing of powered by fiware application: the Digital EnablerStress testing of powered by fiware application: the Digital Enabler
Stress testing of powered by fiware application: the Digital Enabler
 
ScioTalks | Coverage Based Testing
ScioTalks | Coverage Based TestingScioTalks | Coverage Based Testing
ScioTalks | Coverage Based Testing
 
Writing useful automated tests for the single page applications you build
Writing useful automated tests for the single page applications you buildWriting useful automated tests for the single page applications you build
Writing useful automated tests for the single page applications you build
 
Testing Interview Questions.pdf
Testing Interview Questions.pdfTesting Interview Questions.pdf
Testing Interview Questions.pdf
 
The Automation Firehose: Be Strategic and Tactical by Thomas Haver
The Automation Firehose: Be Strategic and Tactical by Thomas HaverThe Automation Firehose: Be Strategic and Tactical by Thomas Haver
The Automation Firehose: Be Strategic and Tactical by Thomas Haver
 
unittesting-190620114546 (1).pptx document
unittesting-190620114546 (1).pptx documentunittesting-190620114546 (1).pptx document
unittesting-190620114546 (1).pptx document
 
Unit 1 sepm cleanroom engineering
Unit 1 sepm cleanroom engineeringUnit 1 sepm cleanroom engineering
Unit 1 sepm cleanroom engineering
 
Improving your CFML code quality
Improving your CFML code qualityImproving your CFML code quality
Improving your CFML code quality
 
Combinatorial testing
Combinatorial testingCombinatorial testing
Combinatorial testing
 
Presentation
PresentationPresentation
Presentation
 
Black & White Box testing
Black & White Box testingBlack & White Box testing
Black & White Box testing
 
Combinatorial testing ppt
Combinatorial testing pptCombinatorial testing ppt
Combinatorial testing ppt
 
Test strategicaly
Test strategicalyTest strategicaly
Test strategicaly
 
PHPUnit - Unit testing
PHPUnit - Unit testingPHPUnit - Unit testing
PHPUnit - Unit testing
 
The Role Of The Sqa In Software Development By Jim Coleman
The Role Of The Sqa In Software Development By Jim ColemanThe Role Of The Sqa In Software Development By Jim Coleman
The Role Of The Sqa In Software Development By Jim Coleman
 

Recently uploaded

Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
KrzysztofKkol1
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
varshanayak241
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
NaapbooksPrivateLimi
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Hivelance Technology
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
XfilesPro
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
Jelle | Nordend
 

Recently uploaded (20)

Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 

UNIT TESTING

  • 1. Copyright © 2017 Crisan Marius Catalin
  • 2. Agenda Introduction What is unit testing? Test types Static testing White box testing Tool support Copyright © 2017 Crisan Marius Catalin
  • 3. Introduction Who am I? ►ISTQB certified ►Software testing and development ►More than 2 years working experience in automotive area Copyright © 2017 Crisan Marius Catalin
  • 4. Introduction Copyright © 2017 Crisan Marius Catalin What is a unit? ►software component that contains one or more routines ►also known as module, component ►all variables and functions from a module may respect a naming convention Software system architecture
  • 5. Introduction Copyright © 2017 Crisan Marius Catalin ►A module encapsulates code and data to implement a particular functionality. MODULE FUNCTIONALITY
  • 6. Introduction Copyright © 2017 Crisan Marius Catalin ► All modules together form the software system. ► The modules communicate with each other to fulfill the system requirements.
  • 7. What is unit testing? Copyright © 2017 Crisan Marius Catalin ► also known as unit, module or program testing ► searches for defects in, and verifies the functioning of, software modules, programs, objects, classes, etc., that are separately testable.
  • 8. What is unit testing? Copyright © 2017 Crisan Marius Catalin • lowest level of testing • tested in isolation • most through look at detail • tests are written and run by software developers
  • 9. What is unit testing? Copyright © 2017 Crisan Marius Catalin Test cases are derived from work products such as: • specification of the component, • software design, • data model.
  • 10. What is unit testing? Copyright © 2017 Crisan Marius Catalin Software development process V-Model When is unit testing performed?
  • 11. What is unit testing? Copyright © 2017 Crisan Marius Catalin When is unit testing performed?
  • 12. Unit testing vs Traditional testing Copyright © 2017 Crisan Marius Catalin Traditional Testing • Test the system as a whole • Individual components rarely tested • Errors go undetected • Source of errors difficult to track down
  • 13. Unit testing vs Traditional testing Copyright © 2017 Crisan Marius Catalin Unit Testing • Each part tested individually • All components tested at least once • Errors picked up earlier • Scope is smaller, easier to fix errors
  • 14. Benefits Copyright © 2017 Crisan Marius Catalin • Unit testing allows the programmer to refactor code at a later date, and make sure the module still works correctly. • By testing the parts of a software application first and then testing the sum of its parts, integration testing becomes much easier. • Unit testing provides a sort of living documentation of the system.
  • 15. Test types Copyright © 2017 Crisan Marius Catalin A test type is focused on a particular test objective, which could be any of the following: ►A function to be performed by the software ►A non-functional quality characteristic, ►The structure or architecture of the software, ►Change related. Component testing include all above.
  • 16. Functional testing Copyright © 2017 Crisan Marius Catalin ►is the testing of “what” the system does ►based on functions and features (described in documents or understood by the testers) and their interoperability ►considers the external behavior of the software (black-box testing)
  • 17. Functional testing Copyright © 2017 Crisan Marius Catalin ► security testing: investigates the functions relating to detection of threats, such as viruses, from malicious outsiders ► interoperability testing: evaluates the capability of the software product to interact with one or more specified components or systems
  • 18. Non-functional testing Copyright © 2017 Crisan Marius Catalin ►is the testing of “how” the system works ►describes the tests required to measure characteristics of systems and software that can be quantified on a varying scale ►considers the external behavior of the software (black-box testing) ► resource-behavior e.g. searching for memory leaks ► robustness testing
  • 19. Structural testing Copyright © 2017 Crisan Marius Catalin ►based on the structure of code: statement, branch ►measure the thoroughness of testing through assessment of coverage of a type of structure ►coverage is the extent that a structure has been exercised by a test suite, expressed as a percentage of the items being covered ►statement coverage ►decision coverage
  • 20. Testing related to changes Copyright © 2017 Crisan Marius Catalin ► performed: - after a defect is detected and fixed, - when the software, or its environment, is changed. Regression test suites are strong candidate for automation. Impact analysis: determine decide how much regression testing to do
  • 21. Testing related to changes Copyright © 2017 Crisan Marius Catalin ► Confirmation testing - confirming that defects have been fixed BUG FIXED NEW BUG NEW BUG NEW BUG Re-test to check
  • 22. Testing related to changes Copyright © 2017 Crisan Marius Catalin ► Regression testing - looking for unintended changes BUG FIXED NEW BUG NEW BUG NEW BUG Run regression Can’t guarantee to find them all
  • 23. Static techniques Copyright © 2017 Crisan Marius Catalin Static testing techniques rely on the: ► manual examination (reviews) ► automated analysis (static analysis) of the code or other project documentation without the execution of the code
  • 24. Static analysis by tools Copyright © 2017 Crisan Marius Catalin ►analyze program code (control flow and data flow), as well as generated output such as HTML and XML ►early detection of defects prior to test execution ►identification of defects not easily found by dynamic testing
  • 25. Static analysis Copyright © 2017 Crisan Marius Catalin ►Techniques: Control flow analysis Data flow analysis Compliance to standards Calculation of code metrics
  • 26. Static analysis Copyright © 2017 Crisan Marius Catalin Typical defects discovered by static analysis:  Referencing a variable with an undefined value,  Variables that are never used,  Unreachable (dead) code,  Programming standards violations,  Security vulnerabilities.
  • 27. Static analysis Copyright © 2017 Crisan Marius Catalin Identify the faults:
  • 28. White box testing Copyright © 2017 Crisan Marius Catalin White Box VS Black Box Structure-based techniques Specification-based techniques
  • 29. White box testing Copyright © 2017 Crisan Marius Catalin ►software testing method in which the internal structure/design/implementation of the item being tested is known to the tester ►testing based on an analysis of the internal structure of the component or system. ►known as clear box testing, glass box testing, transparent box testing and structural testing ►mainly applied to unit testing
  • 30. White box testing Copyright © 2017 Crisan Marius Catalin White box concepts
  • 31. White box testing Copyright © 2017 Crisan Marius Catalin 8 statements branch branch condition decision Identify the following: statements, decision, condition, branches.
  • 32. White box testing techniques ►Statement testing ►Decision/branch testing ►Condition testing ►Multiple condition testing ►Condition determination testing ►Loop testing(LCSAJ) ►Path testing Copyright © 2017 Crisan Marius Catalin
  • 33. White box testing techniques 1 test is necessary to achieve 100% statement coverage Statement testing Copyright © 2017 Crisan Marius Catalin Statement coverage is the assessment of the percentage of executable statements that have been exercised by a test case suite.
  • 34. White box testing techniques Example 1 Example 2 TC Input Statement coverage Copyright © 2017 Crisan Marius Catalin
  • 35. White box testing techniques 2 tests are necessary to achieve 100% branch coverage Decision/Branch testing Copyright © 2017 Crisan Marius Catalin Decision coverage, related to branch testing, is the assessment of the percentage of decision outcome s (e.g., the True and False options of an IF statement) that have been exercised by a test case suite.
  • 36. White box testing techniques Example TC Input Decision coverage Copyright © 2017 Crisan Marius Catalin
  • 37. White box testing techniques ? ? 3 tests are necessary to achieve 100% path coverage Path testing 1 2 3 Copyright © 2017 Crisan Marius Catalin ►Is a technique in which test cases are designed to ensure that every path has been traversed at least once.
  • 38. White box testing techniques Example TC Input Decision coverage Copyright © 2017 Crisan Marius Catalin
  • 39. White box testing techniques Example Read A Read B IF A >= 2 THEN Print A-B ELSE Print A+B ENDIF IF B < 5 THEN Print A*B ELSE Print B-A ENDIF Minimum number of tests to achieve: • 100% statement coverage: • 100% branch coverage: • 100% path coverage: 2 2 4 Copyright © 2017 Crisan Marius Catalin
  • 40. White box testing techniques ►Is a technique in which test cases are designed to execute combinations of single condition outcomes. ►It requires 𝟐 𝐧 test cases, where n is the number of conditions, to get 100% coverage. 2 tests are necessary to achieve 100% multiple condition coverage Multiple condition testing Copyright © 2017 Crisan Marius Catalin
  • 41. White box testing techniques Example If we take the example for above: We need 8 test cases to get 100% multiple condition coverage. The test cases we need are: Copyright © 2017 Crisan Marius Catalin
  • 42. White box testing techniques What is a STUB? • code that simulates the functionality of the missing components void functionX() { if(boMissingFunction()) /*do something*/ else /*do something*/ } .... /*STUB*/ void boMissingFunction() { return True; } Copyright © 2017 Crisan Marius Catalin
  • 43. White box testing techniques void CarAlarms() { uint8 u8Val=0xFF; u8Val=CheckDoors(); switch(u8Val): { case 0: printf(“Front door open!”); break; case 1: printf(“Rear door open”); break; case 2: printf(“Trunk is open!”); break; case 3: printf(“Hood is open!”); break; default: /*do nothing*/ break; } } TESTED FUNCTION: CarAlarm() STUB: CheckDoors() Copyright © 2017 Crisan Marius Catalin
  • 44. White box testing techniques void CarAlarms() { /*…*/ u8Val=CheckDoors(); /*…*/ } bool CheckDoors() { return True; } TESTED FUNCTION: CarAlarm() STUB: CheckDoors() Copyright © 2017 Crisan Marius Catalin
  • 45. White box testing techniques What is a DRIVER? • software component that takes control of the calling of a function /*DRIVER*/ void functionThatCallsFunctionX() { functionX(100); } .... void functionX(uint8 u8Number) { /*do something*/ } Copyright © 2017 Crisan Marius Catalin
  • 46. White box testing techniques car void Engine(bool boIgnition, bool boActualState) { if(boActualState == NOT_RUNNING) if(boIgnition == True) { StartEngine(); boActualState = RUNNING; } else /*error 1*/ else if(boIgnition == False) { StopEngine(); boActualState = NOT_RUNNING; } else /*error 2*/ } TESTED FUNCTION: Engine() DRIVER: TEST_Engine() Copyright © 2017 Crisan Marius Catalin
  • 47. White box testing techniques void Engine(bool boIgnition, bool boActualState) { /*…*/ } void TEST_Engine() { /*…*/ boIgnition = TRUE; boActualState = NOT_RUNNING; Engine(boIgnition, boActualState); CHECK(boActualState, RUNNING); /*…*/ } TESTED FUNCTION: Engine() DRIVER: TEST_Engine() Copyright © 2017 Crisan Marius Catalin
  • 48. White box testing techniques Test case structure SET INPUTS --------------------------------------- CALL FUNCTION --------------------------------------- CHECK OUTPUT VALUES TEST CASE BODY A=2; B=3; -------------------------------- S=Sum(A,B); -------------------------------- CHECK(S,5); void test_Sum() Copyright © 2017 Crisan Marius Catalin
  • 49. White box testing techniques Test case design approaches:  Function testing  Sequence testing SET INPUTS --------------------------------------- CALL FUNCTION --------------------------------------- CHECK OUTPUT VALUES TEST CASE BODY SET INPUTS --------------------------------------- CALL FUNCTION A CALL FUNCTION B CALL FUNCTION C --------------------------------------- CHECK OUTPUT VALUES TEST CASE BODY Copyright © 2017 Crisan Marius Catalin
  • 50. White box testing techniques Module specification: • Module is responsible for the sound volume. • 3 functions are implemented. SOUND_ENABLE SET_VOLUME SOUND_DISABLE SOUND How is the module tested? Copyright © 2017 Crisan Marius Catalin
  • 51. White box testing techniques Copyright © 2017 Crisan Marius Catalin
  • 52. Tool support Copyright © 2017 Crisan Marius Catalin ► Static Analysis Tools ► Modeling Tools ► Test Harness/Unit Test Framework Tools ► Coverage Measurement Tools ► Dynamic Analysis Tools
  • 53. Guidelines Copyright © 2017 Crisan Marius Catalin ► Name tests properly and provide test specification The typical naming convention is test_[what]. e.g.: test_SaveAs(), test_DeleteProperty() ► Keep tests independent To ensure testing robustness and simplify maintenance, tests should never rely on other tests nor should they depend on the ordering in which tests are executed.
  • 54. Guidelines Copyright © 2017 Crisan Marius Catalin ►Unit tests should be fully automated and non-interactive The test suite is normally executed on a regular basis and must be fully automated to be useful. If the results require manual inspection the tests are not proper unit tests. ►Measure the tests Apply coverage analysis to the test runs so that it is possible to read the exact execution coverage and investigate which parts of the code is executed and not.
  • 55. Guidelines Copyright © 2017 Crisan Marius Catalin ►Provide negative tests Negative tests intentionally misuse the code and verify robustness and appropriate error handling. ►Cover boundary cases Make sure the parameter boundary cases are covered.
  • 56. Conclusion Copyright © 2017 Crisan Marius Catalin With the help of testing it is possible to measure the quality of the software. The code can be optimized by revealing hidden errors and being able to remove these possible defects. Testing reduces the probability of undiscovered defects remaining in the software.
  • 57. Any questions? Copyright © 2017 Crisan Marius Catalin
  • 58. Copyright © 2017 Crisan Marius Catalin Continuous learning is the minimum requirement for success in any field. - Brian Tracy
  • 59. References Copyright © 2017 Crisan Marius Catalin 1.ISTQB Foundation Level Syllabus 2011 http://www.istqb.org/downloads/syllabi/foundation-level- syllabus.html 2. Foundations of Software Testing - Rex Black, Erik Van Veenendaal, Dorothy Graham 3. Guide to Advanced Software Testing - Anne Mette Jonassen Hass 4. Advanced Software Testing(Vol. 3) - Rex Black , Jamie L. Mitchell 5. Images: https://pixabay.com/