Software testing: Difference between revisions

Jump to navigation Jump to search
m
m (→‎Bootstrapping completely new tests: Adding a detailed description of the elements of a single test.)
Line 111: Line 111:
=== Structure of a CPPUnit test ===
=== Structure of a CPPUnit test ===


You're going to create a new test, by
* Choosing an appropriate test group directory and an appropriate topic directory for the new test
* Creating a class in .cxx and .hxx files,
* Add some CPPUNIT boilerplate code, common to all the tests
* Modifying CMakeLists.txt files to ensure your new class is built
* Adding a registration entry for your new class in the chosen directory's TestSuite.cxx file. 


If you look at the example above
These are the test group directories


* flightgear/test_suite/fgdata_tests
* flightgear/test_suite/gui_tests
* flightgear/test_suite/simgear_tests
* flightgear/test_suite/system_tests
* flightgear/test_suite/unit_tests
Under each of these directories, are topic directory
For example, under flightgear/test_suite/unit_tests, you'll find directory names (topics) that roughly correspond to the directories under flightgear/src.
```
└── unit_tests
    ├── Add-ons
    ├── AI
    ├── Airports
    ├── Autopilot
    ├── CMakeLists.txt
    ├── FDM
    ├── general
    ├── Input
    ├── Instrumentation
    ├── Main
    ├── Navaids
    ├── Network
    └── Scripting
```
For this example we'll look at the steps taken to add the httpd tests under test_suite/Network.
Steps:
#  Create two new files: test_suite/Network/test_httpd.cxx and test_httpd.hxx. Note that these filenames start with test_. That's a Flightgear standard.
Add the appropriate license files at the top of each of these files.


=== Headless testing ===
=== Headless testing ===
980

edits

Navigation menu