Get a Java model

First of all, create a data model with the help of the JavaDesigner module. For more information about the creation of data models refer to the JavaDesigner user guide.

The following picture displays a simple example of data model created with JavaDesigner:

image

Generating the test model

Once you have got the elements in your Java model, you can generate the test from it. In order to do that, select the topmost Java package and then call "Create test model" under the "JUnit module" menu.

image

The JUnit Module will generate your test model.

The "Generation report" window (see the picture below) will display the result of this generation. This window may contain two kinds of entries:

  • Informations about the generation,

  • Warnings for problems indicating that do not inhibit the generation of valid test model,

  • and Errors, for most serious problems that block the generation.

image

Notice that, in case of generation warnings, code generated from the test model may be different from the expected one and may fail at compilation.

Generating code, makefile and compilation

If no errors are detected, you may generate the java files for the test model and compile them.

The simplest thing way to compile and run tests is to use the Eclipse IDE and generate all in an Eclipse Java project. Eclipse is fully JUnit aware and you will find in the "Run as" context menu a "JUnit test" command that runs all generated tests at once.

A way to do this:

  1. Go to the tested root package(s)

  2. Right click and choose "JavaDesigner/Generate code" command.
    This command is also available in the "Java" tab toolbar.

  3. Go to the test folder

  4. Right click and choose "JavaDesigner/Generate code" command

  5. Go to the Eclipse IDE

  6. Select the Java project

  7. Run the command "Project/Build project" if "Build automatically" is not activated

  8. Deal with compilation errors

  9. Right click on the Java project and choose "Run as/JUnit test" command.