[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.7 Test Suite

All ns-3 tests are classified into Test Suites and Test Cases. A test suite is a collection of test cases that completely exercise a given kind of functionality. As described above, test suites can be classified as,

This classification is exported from the TestSuite class. This class is quite simple, existing only as a place to export this type and to accumulate test cases. From a user perspective, in order to create a new TestSuite in the system one only has to define a new class that inherits from class TestSuite and perform these two duties.

The following code will define a new class that can be run by test.py as a “unit” test with the display name, “my-test-suite-name”.

  class MySuite : public TestSuite
  {
  public:
    MyTestSuite ();
  };
  
  MyTestSuite::MyTestSuite ()
    : TestSuite ("my-test-suite-name", UNIT)
  {
    AddTestCase (new MyTestCase);
  }
  
  MyTestSuite myTestSuite;

The base class takes care of all of the registration and reporting required to be a good citizen in the test framework.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by root on May 3, 2010 using texi2html 1.82.