Software testing: Difference between revisions

Jump to navigation Jump to search
Changed the sectioning for SimGear vs FlightGear.
(Rewrote the intro text.)
(Changed the sectioning for SimGear vs FlightGear.)
Line 3: Line 3:
The FlightGear source code and data are tested by the FlightGear developers using a number of tools.  This includes automated testing via unit tests in [[SimGear]] and a full test suite with multiple test categories in the [[FlightGear Git|flightgear repository]], as well as manual in-sim testing.
The FlightGear source code and data are tested by the FlightGear developers using a number of tools.  This includes automated testing via unit tests in [[SimGear]] and a full test suite with multiple test categories in the [[FlightGear Git|flightgear repository]], as well as manual in-sim testing.


== Building the test suite ==
== SimGear ==
 
== FlightGear ==
 
=== Building the test suite ===


To run the tests you will need to build FlightGear from source using cmake.  See [[Building FlightGear]] for details.
To run the tests you will need to build FlightGear from source using cmake.  See [[Building FlightGear]] for details.
Line 14: Line 18:
This will also run the full test suite (see below), because you will typically want to write a test and then immediately compile and run it.
This will also run the full test suite (see below), because you will typically want to write a test and then immediately compile and run it.


== Running the test suite ==
=== Running the test suite ===


To run the test suite, simply run <code>./test_suite/fgfs_test_suite</code>
To run the test suite, simply run <code>./test_suite/fgfs_test_suite</code>
Line 32: Line 36:
You can also run individual test cases.  Run <code>./test_suite/fgfs_test_suite -h</code> to see the various options
You can also run individual test cases.  Run <code>./test_suite/fgfs_test_suite -h</code> to see the various options


== Why write unit tests? ==
=== Why write unit tests? ===


A well tested piece of software will have a much lower bug count/load.  An extensive test suite with '''unit tests''', system/functional tests, GUI tests, installer tests, and other categories of tests can significantly help in this regard.
A well tested piece of software will have a much lower bug count/load.  An extensive test suite with '''unit tests''', system/functional tests, GUI tests, installer tests, and other categories of tests can significantly help in this regard.
Line 42: Line 46:
Writing a test as a safety net.  You write the test to pass, make your changes, then make sure that the test still passes.  Then you push both the test and core changes.<ref>https://sourceforge.net/p/flightgear/mailman/message/36977465/</ref>
Writing a test as a safety net.  You write the test to pass, make your changes, then make sure that the test still passes.  Then you push both the test and core changes.<ref>https://sourceforge.net/p/flightgear/mailman/message/36977465/</ref>


== Benefits of unit testing ==
=== Benefits of unit testing ===
There are lots of benefits to writing tests that pass.
There are lots of benefits to writing tests that pass.


Line 61: Line 65:
* Low code quality and standards.  This is related to the learning point.  As long as a test compiles on all OSes without warning, it passes, and Valgrind gives you an ok, it is good enough.  You dont need to be a C++ expert to dive into this shallow end of the pool.
* Low code quality and standards.  This is related to the learning point.  As long as a test compiles on all OSes without warning, it passes, and Valgrind gives you an ok, it is good enough.  You dont need to be a C++ expert to dive into this shallow end of the pool.


== Bootstrapping completely new tests ==
=== Bootstrapping completely new tests ===
To start diving strait into the test suite code, firstly copy what has
To start diving strait into the test suite code, firstly copy what has
been done in this commit: https://sourceforge.net/u/edauvergne/flightgear/ci/8474df
been done in this commit: https://sourceforge.net/u/edauvergne/flightgear/ci/8474df

Navigation menu