-
Notifications
You must be signed in to change notification settings - Fork 3
How to run test cases with AWS Greengrass Testing Framework locally
Rafe Luan edited this page Nov 30, 2022
·
2 revisions
AWS Greengrass Testing Framework uses maven as the build system, it also builds a uber java jar that can be executed on any JVM installed machine. Currently, we only support Unix system and Windows. We are offering 2 ways for developer to run test cases with AWS Greengrass Testing Framework locally, as following:
One way to run test locally is to package them together in uber jar and run the jar.
- The command to create the uber jar(standalone jar) with all the common steps and test cases:
mvn clean package
- Provide aws credentials through either one of below ways:
- Environment variables
- System properties
- Command line arguments
- Download Greengrass Nucleus archive from here.
- Update test log path, Greengrass Nucleus archive path and location of standalone jar in the below command to run all the test cases:
java -Dggc.archive=<archive_path> -Dtest.log.path=<test_result_path> -jar <uber_jar_path>
- If selected test cases needs to be run then
-Dtags
can be specified with the tag marked on top of test case:java -Dggc.archive=<archive_path> -Dtest.log.path=<test_result_path> -Dtags=<tag> -jar <uber_jar_path>
Another way is to use maven commands to run the test case.
- Add an execution flow like following to the pom.xml of your test module. Example.
<execution>
<id>feature-test</id>
<phase>integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<skip>${skipTests}</skip>
<target>
<echo message="Feature Test Suite"/>
<java classname="com.aws.greengrass.testing.launcher.TestLauncher"
fork="true"
failonerror="true"
newenvironment="true"
classpathref="maven.test.classpath">
<!--sysproperty key="ggc.archive" value="aws.greengrass.nucleus.zip"/>-->
<sysproperty key="ggc.archive" value="greengrass-nucleus-latest.zip"/>
<!--uncomment it if the install root directory is pointing to User directory instead of C drive-->
<!--<sysproperty key="ggc.install.root" value="C:\"/>-->
</java>
</target>
</configuration>
</execution>
- Update the path of your sub-module and run the command
mvn clean -DskipTests=false -pl <path_to_your_test_module> -am integration-test
. For more information refer README.