supervisor : magne haveraaen ali...
TRANSCRIPT
![Page 1: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/1.jpg)
Testing with Axioms in C++ 2011
Ali AlnajjarSupervisor : Magne Haveraaen
![Page 2: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/2.jpg)
Intro TDDTest-Driven Development (TDD):
- Writing test before implementing. - The tests provide a specification of the behaviour.- Check the implementation throughout development and refactoring.
![Page 3: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/3.jpg)
IntroLess extreme methods:
- Call for tests for all program units. - ward off the reappearance of known bugs.
All rely on the programmer to:
- invent good test cases- Guarantee that the tests exercise the full expected feature set
![Page 4: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/4.jpg)
Testing with Concepts and Axioms- Axioms specify expected behaviour.
- Axioms are integrated with concepts.
- Axiom-based testing provides reusable tests for all models.
![Page 5: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/5.jpg)
Concepts -- A set of parameters, a set of requirements, and a set of axioms.- Parameters can be TYPES or OPERATIONS.
![Page 6: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/6.jpg)
Requirements - A predicate - Another concept.
![Page 7: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/7.jpg)
Axioms
![Page 8: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/8.jpg)
Models
![Page 9: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/9.jpg)
Testing AxiomsAxiom = Function that calls a macro (axiom_assert)
Testing a single axiom:
![Page 10: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/10.jpg)
Testing Concept
1.test_all obtains a list of all axioms in a concept from the get_axioms function.
2. Testing each axiom using test function.
3. Test all the concept requirements.
![Page 11: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/11.jpg)
Testing ReportsPassed.
OR: is monoid ?
![Page 12: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/12.jpg)
Reusable Tests
Spec:
Concepts
Axioms
Model:
Classes
Test
![Page 13: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/13.jpg)
Reusable Tests
Spec1:
Concept1
Axioms
Spec2:
Concept2
Axioms
Spec:
ConceptsConcept1Concept2
AxiomsAxiomsAxioms
![Page 14: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/14.jpg)
Reusable Tests
a . (b+c) = a . b + a . c
![Page 15: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/15.jpg)
Inheritance-Subclass must satisfy the behaviour specification of the base class.
-Test on references instead of values:
![Page 16: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/16.jpg)
Data Coverage.-all the axioms have been tested.
-a wide and diverse data points tested.
![Page 17: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/17.jpg)
Data Generation.1. user selected data sets.
2. randomly chosen generator terms.
3. randomly chosen data structure values
4. data values harvested from an application.
![Page 18: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/18.jpg)
Data Generation: user selected data setsAnalyse the behaviour of the function.
Select data depending on behaviour.
Select data on the boundaries.
list_data_generator<T...>
![Page 19: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/19.jpg)
Data Generation: random terms generationGenerate random expressions and use their values.
All data values can be generated by some sequence of the available operations
term_generator<T...>
![Page 20: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/20.jpg)
Data Generation: Random field value generationThere is often a particular relationship between the fields of a class.
Implement a specific data generator for each class
default_generator
![Page 21: Supervisor : Magne Haveraaen Ali Alnajjarmagne/inf328s17-info/inf328-2017s-bldl-presentation-05... · Intro TDD Test-Driven Development (TDD): - Writing test before implementing](https://reader034.vdocument.in/reader034/viewer/2022052007/601b118972a05904a428c826/html5/thumbnails/21.jpg)
Data Generation: testing efficiency
Selected Data set
Random Data Set
Selected Data set
20% larger Random Data Set