Running SAM Test Cases as Junit Tests in CI Pipelines
Using SAM’s Test Mode provides a quick and effective way to test your applications locally visualizing the output within each component of the app without deploying to a cluster. Since all of SAM’s capabilities is backed by REST apis, you can execute the these SAM Test Cases as part of your Junit Tests. This provides the power of using Junit assertions to validate the results of the test and incorporating them in automated tests as part of your continuous integration and delivery pipelines.
Examples of incorporating SAM Test Cases as part of unit tests can be found in the following artifacts:
The Junit Test case above uses the SAM SDK project to setup a self contained Junit test that executes the SAM test cases and validates the result. The test case performs the following on setup of the this Junit Test Case:
Create SAM Service Pool
Create SAM Environment
Import the Trucking Ref App
Then the following 4 test cases are executed:
Each of these test cases will do the following:
Create the SAM Test Case
Setup test data for each of the sources for each test case.
Execute the SAM Test Case using SAM Test Mode and wait for test to complete.
Download the results of the test case.
Validate the results of the Test Case.
SAM Test Mode execution via Junit Tests allows you to integrate these tests as part of your continuous integration / delivery pipeline.