Testing an App with the Jasmine Test Framework

Jasmine is a behavior driven development test framework for JavaScript. With App Factory, you can use the Jasmine framework to run test cases for the Native and Desktop Web platforms. For more information, refer to the following sections.

NOTE:
If you want to run Jasmine tests for the Native channel, or if you are using version V9 ServicePack 2 or earlier, you can run Jasmine tests only during the build process (buildVisualizerApp).

Prerequisites

Custom Test Environment

Jasmine tests always run in a Custom Test Environment. App Factory uses the default Appium version to launch the app on the test device. But, you can provide a version number in the Build Parameters to override the Appium version. You can also provide the name of the Test Runner file that you want to run on the test device.

Building and running a test

IMPORTANT:
  • From V9 ServicePack 3, you can test a deployed web app with the Jasmine Test Framework by using the runTest job.
  • To run tests that are independent from the build process, make sure that the Binary URL is public (open) and accessible from App Factory. For example, a URL to an S3 bucket.
  • If you do not have a public Binary URL, Temenos recommends that you run the tests as part of the build process.

To build and run a test, follow these steps:

  1. From the Visualizer folder of your project, navigate to the Tests sub-folder.
  2. For the runTest job, click the Build with Parameters icon on the right side of the row.
    Alternatively, select the runTest 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 the buildVisualizerApp job

You can trigger the tests from the buildVisualizerApp job available at Project Name > Visualizer > Builds folder. It is the simplest way to validate your code by launching tests right after Building the application. There is no need to specify all parameters as they are provided while running the tests manually. The results can be viewed in line to the Test Results of Manual Tests.

Test Results

Native test Results

When the project test build is complete and the test results are published at S3, e-mail notifications are sent to recipients:

On an unsuccessful build for the tests run, the following e-mail is sent to the recipients:

Sample email for Native tests

In the final stage, the consolidated test run status is notified via e-mail. Refer the following screenshots for the sample email for consolidated status.

To download test data that is fetched from the AWS Device Farm, click the Download File link. The data is stored at S3 and available for review without any time limitations.

To view the detailed test report, click the Test Report link.

Desktop Web test results

When the project test build is complete and the test results are published at S3, e-mail notifications are sent to recipients:

On an unsuccessful build for the tests run, the following e-mail is sent to the recipients:

Sample email for Desktop Web tests

In the final stage, the consolidated test run status is notified via e-mail. Refer the following screenshots for the sample email for consolidated status.

The summary of the test results are shown based on the tests executed on specified browser that includes passed, failed, skipped. Usually the tests are skipped when the driver initialization fails.

To view the detailed test report, click the Detailed Test Report link.

To view the details on the browser log, click the Browser Console Log link.

Test Status

Test Status is available in the test result email which is sent to the recipient after you execute the test cases. Following are different statuses in the test result email:

  • PASSED: The status of the test result is PASSED when the test case is executed without any issues, and when the assertion is successful.
  • FAILED: The status of the test result is FAILED when the expected result does not match with the actual result of the test case, and the assertion fails.

The SKIPPED, WARNED, STOPPED, ERRORED statuses are not applicable for Jasmine Tests.

Troubleshooting Issues

The following errors can help you during troubleshooting if the runTest job fails:

  • Error: Jasmine Tests can only be executed when the app is built in Debug mode.
    Solution: Make sure that you have selected the build mode as debug when the app is built before running the tests.
  • Error: Please provide pool to test on.
    Solution: Make sure that you provide a value to AVAILABLE_TEST_POOLS parameter to run the native tests.
  • Error: Sorry, You can't run test for Android Universal binary along with Android Mobile/Tablet.
    Solution: The universal binary tests both the Mobile and Tablet binaries are based on the availability of the devices in the device pool. So it is not required to provide mobile/tablet binary when you give universal binary.
  • Error: Build parameter <parameter name> value is not valid URL!
    Solution: Make sure that the URL you provide for the following parameters is valid:
    • ANDROID_MOBILE_NATIVE_BINARY_URL
    • ANDROID_TABLET_NATIVE_BINARY_URL
    • IOS_MOBILE_NATIVE_BINARY_URL
    • IOS_TABLET_NATIVE_BINARY_URL
    • NATIVE_TESTS_URL

    • ANDROID_UNIVERSAL_NATIVE_BINARY_URL

    • DESKTOPWEB_TESTS_URL

    • IOS_UNIVERSAL_NATIVE_BINARY_URL

The builds that failed during the test can be tracked for the issues that caused the failure. For example, consider build #4 from the following screenshots of runTests job. To troubleshoot the issue, follow these steps.

  1. From your project folder, navigate to Visualizer > Tests.
  2. Select the runTests job, and then find the failed build.
    For example, find and click the link for build #4.
  3. From the details page of the failed build, select the Console Output on the left panel. The Console Output Log opens in the right pane.
  4. Scroll to find errors in the log that caused the build to fail. For example, you can trace an error that is related to invalid Android Tablet URL.
  5. Check if the ANDROID_TABLET_NATIVE_BINARY_URL parameter is valid.

Alternatively you can troubleshoot the issue from the stages of Manual Testing.

To troubleshoot the issue from the Stage View, follow these steps:

  1. From the Stage View, point to the failed stage, and then click Logs.
  2. From log messages in the Stage Logs window, identify the error message that corresponds to the failure of the build.
    For example, you can trace an error that is related to invalid Android Tablet URL.
  3. Check whether the ANDROID_TABLET_NATIVE_BINARY_URL parameter is valid.

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 Visualizer sub-folder, which contains a job for creation of auto-triggered jobs (createTest) and two sub-folders where 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 createTest 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 runTest 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.