Commit f960be8b authored by Sebastian Hörl's avatar Sebastian Hörl
Browse files

Add automated unit tests

parent c21dbde7
Pipeline #28969 failed with stage
in 19 seconds
......@@ -9,3 +9,4 @@ latex/bare_jrnl.synctex.gz
latex/bare_jrnl.pdf
latex/bare_jrnl.log
latex/bare_jrnl.bbl
simulation_output
test:
script:
- export ASTRA_SCENARIO_PATH=/nas/ivtmatsim/tests/astra_2018_002/1pm
- mvn test -DargLine="-Xmx25G"
......@@ -57,10 +57,29 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.ethz.matsim</groupId>
<artifactId>discrete_mode_choice</artifactId>
......
package ch.ethz.matsim.projects.astra_2018_002;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.Test;
import ch.ethz.matsim.baseline_scenario.config.CommandLine.ConfigurationException;
public class RunScenarioTest {
@Test
void testBaseline() throws ConfigurationException {
String scenarioPath = System.getenv("ASTRA_SCENARIO_PATH");
assertNotNull(scenarioPath, "ASTRA_SCENARIO_PATH must be set as an environment variable");
File scenarioFile = new File(scenarioPath);
assertTrue(scenarioFile.isDirectory(), "Cannot find ASTRA scenario at " + scenarioFile.toString());
List<String> args = Arrays.asList( //
"--config-path", new File(scenarioFile, "switzerland_config.xml").toString(), //
"--config:global.numberOfThreads", "4", //
"--config:qsim.numberOfThreads", "4", //
"--config:controler.lastIteration", "2" //
);
RunASTRA2018002.main((String[]) args.toArray());
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment