Skip to content

How to build custom test cases with AWS Greengrass Testing Framework

Rafe Luan edited this page Nov 30, 2022 · 3 revisions

AWS Greengrass Testing Framework offers developers some easy ways to build your custom test cases. There are 2 steps you can follow.

Add feature file

  1. A Feature File is an entry point to the Cucumber tests. This is a file where you will describe your tests in descriptive language (like English). It is an essential part of Cucumber, as it serves as an automation test script as well as live documents.
  2. aws-greengrass-testing-features module contains feature files for all the test cases.
    1. Existing Greengrass Components
      1. Need to add just the feature file. Example.
    2. Custom Components
      1. Create component in aws-greengrass-testing-components, e.g. Mqtt components.
      2. Add recipe file in resources folder of corresponding sub-module of aws-greengrass-testing-features. Example.
      3. Add feature file to same resources folder.

Define Steps

  1. A Step Definition is a Java method with an expression that links it to one or more Gherkin steps. When Cucumber executes a Gherkin step in a scenario, it will look for a matching step definition to execute.
  2. Common Step definitions exist in aws-greengrass-testing-features-api, which is the sub-module of aws-greengrass-testing-features, additional steps related to common feature deployment, resources, etc, could be added to existing corresponding Step classes.
  3. If step definitions specific to the the component need to be added then they could be added to src folder of feature sub-module like MqttSteps (specific for mqtt component).