Maven Sample of Shared Module Unit Test Cases

In this sample, a REST endpoint is exposed by using the HTTPReceiver activity. This activity is responsible for executing fundamental calculator operations.

Here, the behavior of the HTTPReceiver activity is simulated. After the operations are outlined in the mock HTTPReceiver-mockOutput.xml file, the corresponding actions are invoked and the obtained results are verified through assertions.

This particular sample also portrays the Test Suite feature that can encompass test cases for an application module.

    Procedure
  1. From the samples directory, select AppSpace > UnitTesting > SharedModuleUnitTestcases and double-click tibco.bw.UT.sample.Calculator.OperationsSM.zip. Wait for the shared module to be imported into the workspace. Then double-click tibco.bw.UT.sample.Calculator.module.zip.

    For more information, see Accessing Samples.

  2. In the Project Explorer, right-click tibco.bw.UT.sample.Calculator.module.application and select the Generate pom.xml option. The POM Generation window is displayed.

    A project tibco.bw.UT.sample.Calculator.module.application.parent is generated if it does not exist. If it is already present, it then regenerates with updated JAR values.

  3. To run the test cases irrespective of the test suites, right-click tibco.bw.UT.sample.Calculator.module.application.parent and select Run as > Maven test.

  4. To see the result, check the console.

Result

The console displays messages similar to the following:

 


You can also configure the Maven goal to run specific test suites. For example, in the Run As -> Maven build.. field for "Goals”, you can enter the following command:

test -DtestSuiteName=TestSuites\CommutativeOperations.bwts;TestSuite\CalculationSuite.bwts
Result

When running test suites with the Maven goal, the console displays messages similar to the following: