GenCxxTest is an open source Bouml plugout to generate CxxTest test cases and test fixtures for a class or group of classes in a class view.
This plugout can be applied to a class, enum(a UML class with "enum" stereotype) and Class View in a Bouml model.If applied to a class view, it generates test case classes for all the classes in the selected class view. See below for description of how test classes are generated for every class.
If applied to a class, it generates another class (i.e. a test suite) whose name starts with "Test". This new class contains a test method for every public method of the class to be tested (execpt the destructor). The name of the test methods begin with "test".
If this plugout is applied more than once on a class, the method bodies of the test class are preserved.
If applied to an enum (i.e. a class in the browser with "enum" stereotype), it generates CxxTest Enumeration Traits for it and associates it with the AllTests artifact.
If applied to a class view, the plugout generates test suites for all classes in the class view. The dialog box is shown only once. The selections on the dialog box apply to all the classes to be generated.
The names of any operators overloaded by a class are generated in a special way. These names still start with the "test" word as required by CxxTest. Here is a table showing the operator name and its corresponding test method name generated.
Overloaded Operator | Test Method Generated |
operator= | testOperatorAssignment |
operator== | testOperatorEqual |
operator< | testOperatorLess |
operator> | testOperatorGreater |
operator<= | testOperatorLessOrEqual |
operator>= | testOperatorGreaterOrEqual |
operator!= | testOperatorNotEqual |
operator+ | testOperatorPlus |
operator- | testOperatorMinus |
operator* | testOperatorMultiply |
operator/ | testOperatorDivide |
operator% | testOperatorMod |
operator+= | testOperatorPlusAssign |
operator-= | testOperatorMinusAssign |
operator*= | testOperatorMulAssign |
operator/= | testOperatorDivAssign |
operator%= | testOperatorModAssign |
operator>> | testOperatorRightShift |
operator<< | testOperatorLeftShift |
operator>>= | testOperatorRightShiftAssign |
operator<<= | testOperatorLeftShiftAssign |
operator() | testOperatorCall |
operator[] | testOperatorSubscript |
operator^ | testOperatorPower |
operator^= | testOperatorPowerAssign |
operator& | testOperatorBitwiseAnd |
operator&= | testOperatorBitwiseAndAssign |
operator| | testOperatorBitwiseOr |
operator|= | testOperatorBitwiseOrAssign |
operator~ | testOperatorBitwiseNot |
operator~= | testOperatorBitwiseNotAssign |
operator&& | testOperatorLogicalAnd |
operator&&= | testOperatorLogicalAndAssign |
operator|| | testOperatorLogicalOr |
operator||= | testOperatorLogicalOrAssign |
operator++ | testOperatorIncrement |
operator-- | testOperatorDecrement |
operator-> | testOperatorMemberAccessViaPtr |
operator->* | testOperatorPtrMemberAccessViaPtr |
operator new | testOperatorNew |
operator new[] | testOperatorNewArray |
operator delete | testOperatorDelete |
operator delete[] | testOperatorDeleteArray |
If applied to a class view with 'gf' argument, this plugout can generate CxxTest global and world fixtures (See Bouml Tool Setting below).
In order to generate World Fixture, check the "Generate World Fixture" checkbox on the dialog box above. If this checkbox is unchecked, only a global fixture will be generated.
The global fixture classes are named as 'GlobalFixtureN' and the world fixtures are named 'WorldFixtureN', where N=1,2,3 and so on
NOTE: The property GlobalFixtureSuffix in the root package (i.e. Project package) holds the number to be suffixed to the next global/world fixture.
All the test classes (i.e. test suites, fixtures enum traits etc) are automatically associated with the AllTests artifact. This artifact contains a custom definition suitable for CxxTest generator script.
If this artifact already exists, when new test suites or fixtures etc. are generated, they will automatically be added to the existing AllTests artifact and the definition of this artifact will also be updated accordingly.
It is possible to generate different AllTests artifacts in different deployment views just be selecting a different deployment view on the dialog box. This way you can (If you really want) keep test suites of different areas of your code separate. Note however, that there can be only one AllTests artifact in a deployment view and it is easier to just add all the test classes to one artifact and run all tests together.
NOTE: The AllTests artifact only generates a .h file (because .cpp file is not needed by CxxTest).
This plugout can be configured in Bouml in two ways.
The plugout executable is named gencxxtest.
See the file CHANGES.TXT for latest features added to the current version and change history.
You can send queries, bug reports, feature requests etc to my email: sulemankm2 at yahoo dot com.
This software is distributed under the GNU GPL license and all standard disclaimers apply.