Import JUnit test set script
Action: [Open the VendingMachine project]
Action: [Configure the PATH to include the java and javac binaries]
Action: [Resize JaBUTi's window to 1024x768]
Action: [Move mouse to the center of JaBUTi's window]
Speak: JaBUTi supports JUnit test cases. They can be imported accessing the "Executing JUnit Test Set..." item, located at the "Test Case" menu.
Speak: A warning dialog may show up just after activating the "Executing JUnit Test Set". That is because the project's file have not been instrumented.
Action: [Hightlight the dialog]
Speak: As instrumenting is required to test the application, select the 'Yes' option. JaBUTi will instrument the code and create a package with the instrumented Java classes.
Action: [Select in the 'Yes' button]
Speak: After instrumeting the application, a new warning, regarding the presence of a 'main' method in the base class, will be show. If the base classes does have a main method, select 'Yes', otherwise select 'No'. It's usually safe to select 'No'.
Action: [Select the 'No' button]
Speak. A new dialog should be shown now. It indicates that the project was correctly instrumented. Select the 'Ok' button to proceed.
Action: [Select the 'Ok' button]
Speak. Now you should import and configure the JUnit test cases. Many settings are required to run test cases, specially for complex application. Fortunately, the VendingMachine is a very simple project, so setting it up is easy.
Speak. The first field, 'Path to application binary code' is the classpath for the instrumented application. The default setting is the path to the package create just before by JaBUTi. Leave it as it is.
Speak: The next field is the 'Path to JUnit test suite source code. You should configure it to the base directory that contains the files that implement the test cases. This is required so that JaBUTi can compile your test cases.
Action: [Select 'Browse' and choose the 'src' directory]
Speak: Next is the field for the path to JUnit test suite binary code. This is the directory your test cases will be compiled to.
Action: [Select 'Directory' and choose the 'bin' directory]
Speak: For complex application (those that JaBUTi cannot manage to compile or for which the test cases are already compiled), you can just select the directory or package that contains the test cases.
Action: [Move mouse to 'JAR file' and highlight it]
Speak: The 'Test suite full qualified name' is the name of the class that implements the test case. It must be the fully qualified name 'the package name and the class name'. For the VendingMachine, it is vending.VendingMachineTest
Action: [Move mouse to Test suite full qualified name and enter 'vending.VendingMachineTest']
Speak: The JaBUTi's library is the package you used to run JaBUTi. Just select 'Browse' and choose JaBUTi's JAR package.
Action: [Select 'Browse' and choose the file 'Jabuti-bin.jar']
Speak: The field 'Other application specific libraries' is required only if your application (or test cases) requires some third-part library. As this it not the case for the VendingMachine, you can just skip it.
Speak: The remaining field (javac and trace file name) should be left to its default. The javac is the path to the Java compiler and the trace file name is the file which will store the trace generated by the instrumented application.
Speak: After configuring the test case import, we can start the real thing. First, we must compile the test cases.
Action: [Select 'Compile Test Case']
Speak: This will compile the test cases. If the compilation has been successful, the process exit value must be 1. Otherwise, review the configuration and check for errors.
Speak: Next you should run the test cases (normally, without trace).
Action: [Select 'Run Normally (No Trace)']
Speak: If everything was correct, the usual JUnit messages should be shown. On the right, the detected test cases are shown: the correct ones are highlighted in green, the incorrect ones in red. The correct test cases are automatically selected.
Action: [Move mouse to the right and highlight the selected test cases]
Speak: Finally, you should run the test and activate the collection of trace information. Select the 'Run Collecting Trace Information'.
Action: [Select 'Run Collecting Trace Information']
Speak: Now you can close this windows.
Action: [Close the windows]
Speak: Whenever JaBUTi detects that the trace file has been modified, the red button, next to the 'Update' menu item, is activated. Select the 'Update' menu, and then 'Update' again.
Action: [Select the 'Update' menu, and then 'Update' again]
Speak: JaBUTi, using the new trace information, updates the coverage for the application under testing. If you select the menu item 'Summary', and then 'By criterion', the actual coverage for the test cases just executed will be shown.