Test Automation API

The Test Automation REST API enables you to trigger automatic tests.

Documentation

SAP Business Accelerator Hub: https://api.sap.com/api/CALM_TEST_AUTOMATION/resourceInformation published on SAP site

Type

Push API

URL Format

https://<test_automation_tool_URL>/sap-calm-testautomation/api/v1

API Operations

  • POST /scopechanged: Used to notify that a business process has been added to a scope

  • GET /testcases: Retrieves the available test cases

  • GET /testdatavariants: Retrieves test data variants for test cases

  • POST /testcases/execute: Triggers the execution of automated test cases

  • GET /job/status: Gets execution status of a job list

  • GET /testcases/executionhistory: Retrieves the history of the execution statuses for a list of test cases

API Details Operations

Operations

Trigered when

Comments

/scopechanged

This API is called each time a process is added to an SAP Cloud ALM scope.

In the SAP Cloud ALM applications, the scopechanged API is called when the processes are added into any scope from the projects.

The purpose of this API is for the test automation tool to PREPARE for the upcoming testing activities.

These preparation activities are specific to each test automation tool. for example, it could be the creation of the necessary entities in the test automation tool to mark the test cases as SAP Cloud ALM relevant test cases.

/createtestcase

This API triggers the creation of a test case.

Once an automatic test case is created in the SAP Cloud ALM application, the createTestCase API is called.

/testcases

This API allows to retrieve existing test cases from the test automation tool.

In the Test Preparation app from SAP Cloud ALM, the testcases API is called when the synchronisation button is pressed:

The customFlag parameter changes the behaviour of this API.
  • False: all the test cases which are already associated with SAP Cloud ALM should be returned.

  • True: all known test cases in the test automation tool should be returned.

/testdatavariants

This API allows to retrieve the data variants for the automated test cases

Once the testcases API has been called, SAP Cloud ALM will call subsequently the testdatavariants API.

At the moment, SAP Cloud ALM still requires data variant If the tool being integrated does not use or support data variants.

The following behavior could be implemented:
  • Return only one dummy data variant for each test case.

  • Use the same id of the data variant the same as for the test case.

  • Use the same URL for the data variant the same as for the test case.

/testcases/execute

This API triggers the execution of a test case in the test automation tool.

This API is used when the test cases are executed in the Test Execution app in SAP Cloud ALM.

/job/status

This API retrieves the status of an execution job.

This API is called when pushing the refresh button in the Test Execution app.

/testcases/executionhistory

This API retrieves the history of a test case execution.

This API is called when pushing the refresh button in the Test Execution app and

Once the job status is refreshed, if the status is finished, the /testcases/executionhistory API is also called.

Request Parameters

Path parameters

Name

Description

N/A

 

Query Parameters

Name

Description

Comments

project

The SAP Cloud ALM project identifier. A customer can create multiple projects in SAP Cloud ALM, and the test cases are always project specific. So, this information should be stored by the automation provider as an attribute of all automated test cases.

projectName

This is the readable name of the SAP Cloud ALM project. This name can be changed in SAP Cloud ALM, so this should not be used as an identifier. The 'project' field is the real identifier.

scope

The SAP Cloud ALM scope identifier. A customer can create multiple scopes within one project in SAP Cloud ALM and the test cases are always project and scope specific. So, this information should be stored by the automation provider as an attribute of all the automated test cases.

scopeName

This is the readable name of the SAP Cloud ALM scope. This name can be changed in SAP Cloud ALM, so it should not be used as an identifier. The 'scope' field is the real identifier.

processGlobalId

The identifier to which the test case is related. This is used for creation or retrieval. This is a unique identifier which never changes.

processName

The human readable name of the process. This can be changed on the SAP Cloud ALM side

process

Obsolete parameter. To be ignored

calmTenantId

The SAP Cloud ALM tenant ID uniquely identifies the calling SAP Cloud ALM system. This tenant ID can be used for routing (if needed) by the automation tool.

calmTenantLabel

The SAP Cloud ALM tenant label can be displayed in the user interface of the test automation provider.

sutTenant

The System Under Test (SUT) tenant ID can be used by the test automation provider to perform some internal mapping.

sutSystemType

The System Under Test (SUT) system type can be, for example, SAP S/4HANA, SAP Concur, etc.

sutSystemId

The System Under Test (SUT) system ID can be used by the automation provider tool to identify the SUT. It can be, for example, ABC, 123, etc.

sutBaseUrl

The System Under Test (SUT) base URL can be used to match the automated test case in the test automation provider.

Response body parameters

Operation

Output parameters

scopechanged

 

createtestcase

  • id: The unique identifier of the test case in the test automation tool

  • url: The URL which will be used to navigate from SAP Cloud ALM to the test automation tool

/testcases/execute

  • testCaseId: The unique identifier of the test case in the test automation tool

  • name

  • description

  • url: The URL which will be used to navigate from SAP Cloud ALM to the test case in the test automation tool

  • processGlobalId: the ID to which the test case is related

testdatavariants

  • id: The variant ID

  • name: the name of the variant

  • description (Not used yet in SAP Cloud ALM UI)

  • url: The URL which will be used to navigate from SAP Cloud ALM to the variant in test automation tool

/testcases/execute

  • testCaseId

  • testDataVariantId

  • jobURL: The URL to navigate to the execution job

  • jobID

  • jobname: Not displayed in the SAP Cloud ALM UI at the moment

/job/status

  • jobID

  • status: possible values are: planned | starting | running | finished | aborted | unknown

  • percentage: 0-100

/testcases/executionhistory

  • testCaseId

  • testDataVariantId

  • resultStatus: successful | failed

  • Message: short message of 1000 characters for short overview in SAP Cloud ALM

Authorizations

Users need access to an SAP BTP destination from your SAP Cloud ALM tenant to the external automation testing tool.

Example

Retrieve all Test Cases:

GET https://<test_automation_tool_URL>/sap-calm-testautomation/api/v1/testcases