-
Notifications
You must be signed in to change notification settings - Fork 30
Creating an Integration Test
An Integration test consists of running an inference trace combined with a bundle in an automated fashion. The inference trace format supports expected results, which the integration tests framework then verifies if present. This allows verification of the inference process.
Follow the simple steps below to add an integration test.
Add a trace of the activity to this directory:
onebusaway-nyc/onebusaway-nyc-integration-tests/src/integration-test/resources/traces
Go to create a trace to better understand the trace format.
If the bundle was build with the onebusaway-nyc-admin-webapp, the inputs directory of the bundle associated with this trace will contain the original GTFS. Place the GTFS in a directory named after the bundle ({BUNDLE_NAME}) in this directory:
onebusaway-nyc/onebusaway-nyc-integration-tests/src/integration-test/resources/bundle/gtfs
You may pair down the GTFS to what is appropriate to increase the speed of the integration test.
Occasionally other source data is combined with the GTFS to aid in inference. If any external data is required, add it in a subdirectory of
onebusaway-nyc/onebusaway-nyc-integration-tests/src/integration-test/resources/bundle/
Again, name the directory based on the name of the bundle.
Create a Java file that extends AbstractTraceRunner in the following location:
onebusaway-nyc/onebusaway-nyc-integration-tests/src/test/java/org/onebusaway/nyc/integration_tests/vehicle_tracking_webapp/cases
of format:
package org.onebusaway.nyc.integration_tests.vehicle_tracking_webapp.cases; import org.onebusaway.nyc.integration_tests.vehicle_tracking_webapp.AbstractTraceRunner; /** * Describe the situation this trace is testing for. * */ public class Trace_{TRACE_NAME}_IntegrationTest extends AbstractTraceRunner { public Trace_{TRACE_NAME}_IntegrationTest() throws Exception { super("{TRACE_NAME}.csv"); // Date format is 2013-07-15T19:40:00EDT setBundle("{BUNDLE_NAME}", "{TIME_OF_START_OF_TRACE}"); } }
For performance reasons, the integration tests are run in a set order. This minimizes the number of bundle swaps necessary. Due to this however, new integration tests need to be manually added to the TestSuite. they are not discovered automatically.
To add a new integration tests to the TestSuite, edit
onebusaway-nyc/onebusaway-nyc-integration-tests/src/test/java/org/onebusaway/nyc/integration_tests/TestSuite.javaand add the class to the list of _SuiteClasses_ in the appropriate location. # Run integration tests Test that the work you did above passes:user@localhost:~src/onebusaway-nyc$ mvn clean installuser@localhost:~src/onebusaway-nyc$ git commit -a -m "adding integration tests {TRACE_NAME}" && git push