Ch5-2-source - Introduction to Software Testing Chapter 5.2...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Introduction to Software Testing Chapter 5.2 Program-based Grammars Paul Ammann & Jeff Offutt http://www cs gmu edu/ offutt/softwaretest http://www.cs.gmu.edu/~offutt/softwaretest/ Applying Syntax-based Testing to Programs Syntax-based criteria originated with programs and have been used most with programs BNF criteria are most commonly used to test compilers Mutation testing criteria are most commonly used for unit testing and integration testing of classes Introduction to Software Testing (Ch 5) © Ammann & Offutt 2
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Instantiating Grammar-Based Testing Grammar-Based Testing Program-based Integration Model-Based Input-Based Grammar String mutation Program mutation Valid strings Mutants are not tests Must kill mutants String mutation FSMs Model checking Valid strings Traces are tests String mutation Input validation testing XML and others String mutation 5.2 Introduction to Software Testing (Ch 5) © Ammann & Offutt 3 Compiler testing Valid and invalid strings Input validation testing XML and others Valid strings Grammar Test how classes interact Valid strings Mutants are not tests Must kill mutants Includes OO Invalid strings No ground strings Mutants are tests BNF Testing for Compilers (5.2.1) Testing compilers is very complicated Millions of correct programs ! Compilers must recognize and reject incorrect programs BNF criteria can be used to generate programs to test all language features that compilers must process This is a very specialized application and not discussed in detail Introduction to Software Testing (Ch 5) © Ammann & Offutt 4
Background image of page 2
3 Program-based Grammars (5.2.2) The original and most widely known application of syntax-based testing is to modify programs Operators modify a ground string (program under test) to create mutant programs Mutant programs must compile correctly (valid strings ) Mutants are not tests , but used to find tests Once mutants are defined, tests must be found to cause mutants to fail when executed This is called “killing mutants Introduction to Software Testing (Ch 5) © Ammann & Offutt 5 Killing Mutants Given a mutant m M for a ground string program P and a test t , t is said to kill m if and only if the output of t on P is different from the output of t on m . If mutation operators are designed well, the resulting tests will be very powerful Different operators must be defined for different programming languages and goals Testers can keep adding tests until all mutants have been killed Dead mutant : A test case has killed it Stillborn mutant : Syntactically illegal Trivial mutant : Almost every test can kill it Equivalent mutant : No test can kill it (equivalent to original program) Introduction to Software Testing (Ch 5) © Ammann & Offutt 6
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Program-based Grammars Original Method int Min (int A, int B) { With Embedded Mutants int Min (int A, int B) { Replace one variable with another int minVal;
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/17/2012 for the course SWE 637 taught by Professor Offutt,j during the Fall '08 term at George Mason.

Page1 / 11

Ch5-2-source - Introduction to Software Testing Chapter 5.2...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online