Testing a Fabric app with the Cucumber Framework

Cucumber is a behavior-driven development (BDD) framework that is used to validate test-case scenarios. From V9 ServicePack 5, you can use the Cucumber framework to run tests on Fabric projects.

Prerequisites

The test resources must be placed as a Maven project at the following path of your SCM:
<fabric_project_source>/<testResources>/Cucumber/
Make sure that the pom.xml file is in the testResources/Cucumber/ folder.

Alternatively, you can upload the test resources as a zip file in the TEST_ZIP_PACKAGE parameter.

Building and running a test

To build and run a test, follow these steps:

  1. From the Fabric folder of your project, navigate to the Tests sub-folder.
  2. For the runFabricTests job, click the Build with Parameters icon on the right side of the row.
    Alternatively, select the runFabricTests job, and then from the left panel of the details page, select Build with Parameters.
  3. Configure the build parameters for the runTest job. For more information about the parameters, refer to the following sections.

Running Tests from other jobs

You can trigger the test from the buildFabricApp job available in the Project Name > Fabric > Builds folder. You can also create an auto-triggered test from the createFabricTest job available in the Project Name > Fabric > Tests folder.

Auto-Triggering Tests

App Factory supports two types of auto-triggered test jobs: scm-triggered (Watchers) and cron-triggered (Schedulers). Every project contains a folder called Tests in the Fabric sub-folder, which contains a job for creation of auto-triggered jobs (createFabricTest) and two sub-folders where the created jobs are stored.

To setup an auto-triggered test job, follow these steps:

  1. From the project folder, navigate to the Tests sub-folder.
  2. Select the createFabricTest job.
  3. Configure the CRON_SCHEDULE parameter based on your requirement.
    • If you want to create a Scheduler, type a Cron expression that corresponds to the time at which the build job must be triggered.

      For information about cron expressions, refer to Cron.
    • If you want to create a Watcher, leave the CRON_SCHEDULE parameter blank.
  4. Configure the remaining parameters, which are the same as the runFabricTest job.
  5. After you configure all the parameters, click BUILD.
NOTE:
  • Every Scheduler that is created contains the cron string in job name to simplify the job search.
  • Every Watcher that is created contains the branch name in job name to simplify the job search.

Test Results

After a test run is complete, an email that contains the test results is sent to the addresses that are configured in the project settings.

The email displays information about the test run, such as the number of passed and failed test cases, build number, build URL, and build duration. The email also contains links to the various test reports.

Sample email for Fabric test results