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/

UNIT TESTING

  • 1.
    Copyright © 2017Crisan Marius Catalin
  • 2.
    Agenda Introduction What is unittesting? Test types Static testing White box testing Tool support Copyright © 2017 Crisan Marius Catalin
  • 3.
    Introduction Who am I? ►ISTQBcertified ►Software testing and development ►More than 2 years working experience in automotive area Copyright © 2017 Crisan Marius Catalin
  • 4.
    Introduction Copyright © 2017Crisan 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 © 2017Crisan Marius Catalin ►A module encapsulates code and data to implement a particular functionality. MODULE FUNCTIONALITY
  • 6.
    Introduction Copyright © 2017Crisan Marius Catalin ► All modules together form the software system. ► The modules communicate with each other to fulfill the system requirements.
  • 7.
    What is unittesting? 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 unittesting? 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 unittesting? 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 unittesting? Copyright © 2017 Crisan Marius Catalin Software development process V-Model When is unit testing performed?
  • 11.
    What is unittesting? Copyright © 2017 Crisan Marius Catalin When is unit testing performed?
  • 12.
    Unit testing vsTraditional 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 vsTraditional 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 © 2017Crisan 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 tochanges 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 tochanges 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 tochanges 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 bytools 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 testingtechniques ►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 testingtechniques 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 testingtechniques Example 1 Example 2 TC Input Statement coverage Copyright © 2017 Crisan Marius Catalin
  • 35.
    White box testingtechniques 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 testingtechniques Example TC Input Decision coverage Copyright © 2017 Crisan Marius Catalin
  • 37.
    White box testingtechniques ? ? 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 testingtechniques Example TC Input Decision coverage Copyright © 2017 Crisan Marius Catalin
  • 39.
    White box testingtechniques 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 testingtechniques ►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 testingtechniques 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 testingtechniques 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 testingtechniques 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 testingtechniques void CarAlarms() { /*…*/ u8Val=CheckDoors(); /*…*/ } bool CheckDoors() { return True; } TESTED FUNCTION: CarAlarm() STUB: CheckDoors() Copyright © 2017 Crisan Marius Catalin
  • 45.
    White box testingtechniques 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 testingtechniques 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 testingtechniques 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 testingtechniques 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 testingtechniques 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 testingtechniques 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 testingtechniques 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 © 2017Crisan 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 © 2017Crisan 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 © 2017Crisan 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 © 2017Crisan 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 © 2017Crisan Marius Catalin Continuous learning is the minimum requirement for success in any field. - Brian Tracy
  • 59.
    References Copyright © 2017Crisan 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/