Test Cases API

The Test Cases API enables you to manage manual test cases and their related entities in SAP Cloud ALM.

Documentation

SAP Business Accelerator Hub: https://api.sap.com/api/CALM_TM/overviewInformation published on SAP site

Type

Pull API

URL Format

https://{tenant}.{region}.alm.cloud.sap/api/calm-testmanagement/v1/

API Operations

Manual Test Cases

  • GET /ManualTestCases: Retrieves a list of all manual test cases

  • POST /ManualTestCases: Creates a new manual test case with all attributes

  • GET /ManualTestCases/{uuid}: Retrieves a single manual test case by its UUID

  • PATCH /ManualTestCases/{uuid}: Updates a manual test case by its UUID

  • DELETE /ManualTestCases/{uuid}: Deletes a manual test case by its UUID (only works if no execution history exists)

  • POST /ManualTestCases/{uuid}/api.v1.ExternalServiceAPI.forceDeletionIncludingTestRunsAndResults: Forces deletion of a manual test case including all associated test runs and test results (requires the calm-api.testcases.force-delete scope)

Automated Test Cases

  • GET /AutomatedTestCases: Retrieves a list of all automated test cases

  • GET /AutomatedTestCases/{uuid}: Retrieves a single automated test case by its UUID

  • GET /AutomatedTestCases/{uuid}/toReferences: Retrieves a list of all references of one automated test case

  • POST /AutomatedTestCases/{uuid}/toReferences: Creates a new reference for one automated test case

  • GET /AutomatedTestCases/{uuid}/toTagAssignments: Retrieves a list of all tags assigned to one automated test case

  • GET /AutomatedTestCases/{uuid}/toTaskAssignments: Retrieves a list of all tasks assigned to one automated test case

  • POST /AutomatedTestCases/{uuid}/toTaskAssignments: Creates a new task assignment for one automated test case

Activities

  • GET /Activities: Retrieves a list of all activities assigned to one manual test case

  • POST /Activities: Creates a new activity with a title for one manual test case

  • GET /Activities/{uuid}: Retrieves a single activity by its UUID

  • PATCH /Activities/{uuid}: Updates an activity by its UUID

  • DELETE /Activities/{uuid}: Deletes an activity by its UUID

  • GET /Activities/{uuid}/parent: Retrieves a parent manual test case from one activity

  • GET /Activities/{uuid}/toActions: Retrieves a list of all actions assigned to one activity

  • POST /Activities/{uuid}/toActions: Creates a new action for one activity

  • GET /Activities/{uuid}/toApplications: Retrieves a list of all applications assigned to one activity

  • POST /Activities/{uuid}/toApplications: Creates a new application for one activity

Actions

  • GET /Actions: Retrieves a list of all actions assigned to one activity

  • POST /Actions: Creates a new action with title, description and expected result for one activity

  • GET /Actions/{uuid}: Retrieves a single action by its UUID

  • PATCH /Actions/{uuid}: Updates an action by its UUID

  • DELETE /Actions/{uuid}: Deletes an action by its UUID

  • GET /Actions/{uuid}/parent: Retrieves a parent activity from one action

Applications

  • GET /Applications: Retrieves a list of all applications assigned to one activity

  • POST /Applications: Creates a new application with target URL and display name for one activity

  • GET /Applications/{uuid}: Retrieves a single application by its UUID

  • PATCH /Applications/{uuid}: Updates an application by its UUID

  • DELETE /Applications/{uuid}: Deletes an application by its UUID

  • GET /Applications/{uuid}/parent: Retrieves a parent activity from one application

References

  • GET /References: Retrieves a list of all URL references assigned to one manual or automated test case

  • POST /References: Creates a new URL reference with target URL and display name for one manual or automated test case

  • GET /References/{uuid}: Retrieves a single URL reference by its UUID

  • PATCH /References/{uuid}: Updates a URL reference by its UUID

  • DELETE /References/{uuid}: Deletes a URL reference by its UUID

  • GET /References/{uuid}/parentActivity: Retrieves a parent activity from one reference

  • GET /References/{uuid}/parentTestCase: Retrieves a parent manual test case from one reference

Tag Assignments

  • GET /TagAssignments: Retrieves a list of all tags assigned to one manual or automated test case

Task Assignments

  • GET /TaskAssignments: Retrieves a list of all tasks assigned to one test case

  • GET /TaskAssignments/{uuid}: Retrieves a single task assignment by its UUID

  • POST /TaskAssignments: Creates a new task assignment with one manual or automated test case and task entity

  • DELETE /TaskAssignments/{uuid}: Deletes a task assignment by its UUID

Authorizations

Users require the following scopes to access the API:

Scope

Description

Risk Level

calm-api.testcases.read

Read access to testcase entities

Low

calm-api.testcases.write

Write access to testcase entities

Medium

calm-api.testcases.delete

Delete access to testcase entities without test runs and results

Medium

calm-api.testcases.force-delete

Delete access to testcase entities including test runs and results

High

When configuring API access for the Test Cases API, carefully consider which scopes to grant based on your use case:

Standard Setup (Recommended)

For most integrations, use only the following scopes:
  • calm-api.testcases.read

  • calm-api.testcases.write

  • calm-api.testcases.delete

Advanced Setup (Use with Caution)

The calm-api.testcases.force-delete scope should only be granted if absolutely necessary and with careful consideration.

When to use this setup:
  • Data migration scenarios requiring cleanup of legacy test cases

  • Administrative cleanup of test environments

When not to use this setup:
  • Regular API integration for test case management

  • Automated test case synchronization

  • Standard CRUD operations on test cases

For more information, see Deleting Test Cases.

Best Practices for Authorizations

  • Principle of Least Privilege: Only grant the minimum scopes required for your use case

  • Regular Access Review: Periodically review and audit which integrations have force-delete access

  • Monitoring: Implement logging and monitoring for force-delete operations

  • Documentation: Document why the force-delete scope was granted for specific integrations

Attributes

Field Length Restrictions

The following maximum field lengths apply:

  • Title: 255 characters

  • Description: 32767 characters

  • Expected Result: 32767 characters

  • URL: 5000 characters

  • Name: 255 characters

Priority Codes

The following priority codes can be used to indicate the relative importance or urgency of the test case:
  • Very High – 10

  • High – 20

  • Medium – 30

  • Low – 40

Examples

GET Manual Test Case

Request

Response

GET https://<tenant name>.<region>.alm.cloud.sap/api/calm-testmanagement/v1/ManualTestCases/{uuid}

{
  "uuid": "01234567-89ab-cdef-0123-456789abcdef",
  "title": "Sample Manual Test Case",
  "isPrepared": true,
  "projectId": "11111111-1111-1111-1111-111111111111",
  "scopeId": "01234567-89ab-cdef-0123-456789abcdef",
  "priorityCode": 30,
  "modifiedAt": "2025-11-17T15:51:04Z",
  "toActivities": [
    {
      "uuid": "01234567-89ab-cdef-0123-456789abcdef",
      "title": "Login Activity",
      "sequence": 1,
      "isInScope": true,
      "toActions": [
        {
          "uuid": "01234567-89ab-cdef-0123-456789abcdef",
          "title": "Enter username",
          "description": "Enter valid username in the login field",
          "expectedResult": "Username should be accepted",
          "sequence": 1,
          "isEvidenceRequired": false
        }
      ]
    }
  ],
  "toReferences": [
    {
      "uuid": "01234567-89ab-cdef-0123-456789abcdef",
      "name": "User Manual",
      "url": "https://help.sap.com/docs/user-manual"
    }
  ]
}

GET Automated Test Case

Request

Response

GET https://<tenant name>.<region>.alm.cloud.sap/api/calm-testmanagement/v1/AutomatedTestCases/{uuid}

{
  "uuid": "00035171-91aa-434c-a92d-d8dd4b95e608",
  "title": "Accounts Payable - J60 - US",
  "projectId": "9156dd5d-a5ac-4a6c-8754-c171b81249ec",
  "scopeId": "51f2db6f-2ab4-4bd0-af0f-5b0df4ab06d2",
  "solutionProcessId": "SP_J60_18",
  "contentPackageId": "EARL_SolS-013",
  "isPrepared": false,
  "priorityCode": 30,
  "createdAt": "2025-03-18T08:38:39.529692900Z",
  "modifiedAt": "2025-03-18T08:38:39.529692900Z",
  "datavariantId": "3F7CF38EF08D1FD080EA2B85B0CE4D5D",
  "datavariantName": "DEFAULT_VARIANT",
  "displayId": "8-2-2514",

}

POST Manual Test Case

Request

Response

Request:

POST https://<tenant name>.<region>.alm.cloud.sap/api/calm-testmanagement/v1/ManualTestCases

Request Body:

{
  "title": "New Manual Test Case",
  "projectId": "11111111-1111-1111-1111-111111111111",
  "scopeId": "01234567-89ab-cdef-0123-456789abcdef",
  "priorityCode": 20,
  "isPrepared": false,
  "toActivities": [
    {
      "title": "Test Login Process",
      "sequence": 1,
      "isInScope": true,
      "toActions": [
        {
          "title": "Enter credentials",
          "description": "Enter username and password",
          "expectedResult": "User should be logged in successfully",
          "sequence": 1,
          "isEvidenceRequired": true
        }
      ]
    }
  ],
  "toReferences": [
    {
      "name": "Documentation",
      "url": "https://help.sap.com/docs"
    }
  ]
}
{
  "uuid": "01234567-89ab-cdef-0123-456789abcdef",
  "title": "New Manual Test Case",
  "isPrepared": false,
  "projectId": "11111111-1111-1111-1111-111111111111",
  "scopeId": "01234567-89ab-cdef-0123-456789abcdef",
  "priorityCode": 20,
  "modifiedAt": "2025-11-17T15:51:04Z",
  "toActivities": [
    {
      "uuid": "01234567-89ab-cdef-0123-456789abcdef",
      "title": "Test Login Process",
      "sequence": 1,
      "isInScope": true,
      "toActions": [
        {
          "uuid": "01234567-89ab-cdef-0123-456789abcdef",
          "title": "Enter credentials",
          "description": "Enter username and password",
          "expectedResult": "User should be logged in successfully",
          "sequence": 1,
          "isEvidenceRequired": true
        }
      ]
    }
  ],
  "toReferences": [
    {
      "uuid": "01234567-89ab-cdef-0123-456789abcdef",
      "name": "Documentation",
      "url": "https://help.sap.com/docs"
    }
  ]
}

POST Reference

Request

Response

Request:

POST https://<tenant name>.<region>.alm.cloud.sap/api/calm-testmanagement/v1/References

Request Body:

{
  "name": "SAP Help Portal",
  "url": "https://help.sap.com",
  "parentTestCase_ID": "01234567-89ab-cdef-0123-456789abcdef"
}
{
  "uuid": "01234567-89ab-cdef-0123-456789abcdef",
  "name": "SAP Help Portal",
  "url": "https://help.sap.com",
  "parentTestCase_ID": "01234567-89ab-cdef-0123-456789abcdef"
}

Process-Linked Test Cases

SAP Cloud ALM allows you to create test cases that are directly linked to business processes, providing full traceability between test coverage and process execution. This enables better process coverage analysis and ensures that critical business processes are adequately tested.

Step 1: Getting the Required IDs

Before you can create a process-linked test case, you need to retrieve 4 essential IDs that establish the process hierarchy:

ID

Description

solutionProcessId

ID of the business process

solutionProcessFlowId

ID of the process flow within that process

solutionProcessFlowDiagramId

ID of the diagram within the process flow

contentPackageId

ID of the content package (typically CUSTOM for custom processes)

Here's how you can retrieve the process IDs:

  1. Retrieve all solution processes for your project and scope, filtering for scoped processes:

    Request

    Response Example

    GET https://<tenant>.<region>.alm.cloud.sap/api/calm-processmanagement/v1/solutionProcesses?projectId={projectId}&scopeId={scopeId}&solutionScenarioId=CUSTOM&$top=500
    
    {
      "value": [
        {
          "solutionProcessId": "CUSTOM.PROCESS.001",
          "solutionProcessVersionName": "Order to Cash Process",
          "solutionScenarioId": "CUSTOM",
          "isScoped": true
        }
      ]
    }
  2. Retrieve the process flows for your selected solution process:

    Request

    Response Example

    GET https://<tenant>.<region>.alm.cloud.sap/api/calm-processauthoring/v1/solutionProcesses/{solutionProcessId}/solutionProcessFlows
    
    {
      "value": [
        {
          "id": "01234567-89ab-cdef-0123-456789abcdef",
          "name": "Standard Order Processing Flow"
        }
      ]
    }
  3. Retrieve the diagrams for your selected process flow:

    Request

    Response Example

    GET https://<tenant>.<region>.alm.cloud.sap/api/calm-processauthoring/v1/solutionProcessFlows/{solutionProcessFlowId}/solutionProcessFlowDiagrams
    
    {
      "value": [
        {
          "id": "fedcba98-7654-3210-fedc-ba9876543210",
          "name": "Order Creation Diagram"
        }
      ]
    }

Step 2: Creating Process-Linked Test Cases

Once you have collected all required IDs, create a test case linked to a process:

Request

Response

Request:
POST https://<tenant>.<region>.alm.cloud.sap/api/calm-testmanagement/v1/ManualTestCases
Content-Type: application/json

Request Body:

{
  "title": "Process-Linked Test Case: Order Processing",
  "projectId": "11111111-1111-1111-1111-111111111111",
  "scopeId": "01234567-89ab-cdef-0123-456789abcdef",
  "solutionProcessId": "CUSTOM.PROCESS.001",
  "solutionProcessFlowId": "01234567-89ab-cdef-0123-456789abcdef",
  "solutionProcessFlowDiagramId": "fedcba98-7654-3210-fedc-ba9876543210",
  "contentPackageId": "CUSTOM",
  "priorityCode": 20,
  "isPrepared": false,
  "toActivities": [
    {
      "sequence": 1,
      "title": "Setup Test Environment",
      "isInScope": true,
      "toApplications": [
        {
          "title": "SAP Fiori Launchpad",
          "url": "https://fiori.apps.library.url"
        }
      ],
      "toActions": [
        {
          "sequence": 1,
          "title": "Login to System",
          "description": "Log in to the SAP system using your credentials",
          "expectedResult": "User is successfully logged in and sees the main dashboard",
          "isEvidenceRequired": true
        }
      ]
    }
  ],
  "toReferences": [
    {
      "name": "Process Documentation",
      "url": "https://help.sap.com/docs/process-guide"
    }
  ]
}
{
  "uuid": "01234567-89ab-cdef-0123-456789abcdef",
  "title": "Process-Linked Test Case: Order Processing",
  "projectId": "11111111-1111-1111-1111-111111111111",
  "scopeId": "01234567-89ab-cdef-0123-456789abcdef",
  "solutionProcessId": "CUSTOM.PROCESS.001",
  "solutionProcessFlowId": "01234567-89ab-cdef-0123-456789abcdef",
  "solutionProcessFlowDiagramId": "fedcba98-7654-3210-fedc-ba9876543210",
  "contentPackageId": "CUSTOM",
  "priorityCode": 20,
  "isPrepared": false,
  "modifiedAt": "2025-11-24T15:51:04Z",
  "toActivities": [
    {
      "uuid": "activity-01234567-89ab-cdef-0123-456789abcdef",
      "sequence": 1,
      "title": "Setup Test Environment",
      "isInScope": true,
      "toActions": [
        {
          "uuid": "action-01234567-89ab-cdef-0123-456789abcdef",
          "sequence": 1,
          "title": "Login to System",
          "description": "Log in to the SAP system using your credentials",
          "expectedResult": "User is successfully logged in and sees the main dashboard",
          "isEvidenceRequired": true
        }
      ],
      "toApplications": [
        {
          "uuid": "app-01234567-89ab-cdef-0123-456789abcdef",
          "title": "SAP Fiori Launchpad",
          "url": "https://fiori.apps.library.url"
        }
      ]
    }
  ],
  "toReferences": [
    {
      "uuid": "ref-01234567-89ab-cdef-0123-456789abcdef",
      "name": "Process Documentation",
      "url": "https://help.sap.com/docs/process-guide"
    }
  ]
}

Deleting Test Cases

The API provides two different methods for deleting test cases, depending on whether the test case has previously been executed:

Method 1: Standard DELETE Operation

Endpoint: DELETE /ManualTestCases/{uuid}

  • Required Scope: calm-api.testcases.delete

  • Use Case: Deletes test cases that have never been executed

  • Behavior: Removes the test case and all its associated data (activities, actions, references, applications)

  • Restrictions: Will fail if the test case has any associated test runs or execution results

  • Headers Required: If-Match header containing the test case's modifiedAt timestamp

Example:
DELETE https://<tenant>.<region>.alm.cloud.sap/api/calm-testmanagement/v1/ManualTestCases/{uuid}
If-Match: 2025-11-17T15:51:04Z
Responses:
  • Success Response: 204 No Content

  • Error Response (if the test case has been executed): 412 Precondition Failed

Method 2: Force-Delete Operation

Endpoint: POST /ManualTestCases/{uuid}/api.v1.ExternalServiceAPI.forceDeletionIncludingTestRunsAndResults

  • Required Scope: calm-api.testcases.force-delete

  • Use Case: Deletes test cases that have been executed and contain test runs or results

  • Behavior: Permanently removes the test case and all associated execution data, including test runs, test results, execution history, and all nested entities (activities, actions, references, applications)

  • Headers Required: If-Match header containing the test case's modifiedAt timestamp

Example:
POST https://<tenant>.<region>.alm.cloud.sap/api/calm-testmanagement/v1/ManualTestCases/{uuid}/api.v1.ExternalServiceAPI.forceDeletionIncludingTestRunsAndResults
If-Match: 2025-11-17T15:51:04Z
Responses:
  • Success Response: 200 OK

  • Authorization Error (if the required scope is missing): 403 Forbidden

Best Practices for Delete Operations

Before you decide on one of the methods, consider the following:
  1. Attempt the standard DELETE operation. This is safer and will protect against accidental data loss.

    If you receive 412 Precondition Failed, the test case has execution data, so you cannot delete it with the standard DELETE operation.

  2. Evaluate business necessity and consider if you really need to delete the execution history.

  3. Consider alternatives: Can you tag the test case as inactive instead of deleting it?

  4. Check the authorization scope. A force-delete requires the specific calm-api.testcases.force-delete scope, not just the calm-api.testcases.delete scope.

Update Operations with ETags

The Test Cases API uses entity tags (called ETags) to prevent concurrent modification conflicts and to ensure data consistency during update and delete operations. This follows the optimistic locking pattern.

Here's how ETags work:
  • ETag Source: The modifiedAt timestamp field serves as the ETag for all entities.

  • Required Header: All PATCH and DELETE operations require an If-Match header.

  • Conflict Prevention: If another user modifies the entity between your read and update, the operation will fail with 412 Precondition Failed.

Update Workflow

  1. Retrieve the current state and ETag.

    Request

    Response Example

    GET https://<tenant>.<region>.alm.cloud.sap/api/calm-testmanagement/v1/ManualTestCases/{uuid}

    {
      "uuid": "01234567-89ab-cdef-0123-456789abcdef",
      "title": "Original Title",
      "modifiedAt": "2025-11-18T10:30:45Z",
      "isPrepared": false
    }
  2. Perform the update with ETag. Use the modifiedAt value as the If-Match header.

    Request

    Response Example

    PATCH https://<tenant>.<region>.alm.cloud.sap/api/calm-testmanagement/v1/ManualTestCases/{uuid}
    If-Match: 2025-11-18T10:30:45Z
    Content-Type: application/json
    {
      "title": "Updated Title",
      "isPrepared": true
    }

Supported Update Operations

Entity

Endpoint

Updatable Fields

Manual Test Case

PATCH /ManualTestCases/{uuid}

title, isPrepared, priorityCode

Activity

PATCH /Activities/{uuid}

title, sequence, isInScope

Action

PATCH /Actions/{uuid}

title, description, expectedResult, sequence, isEvidenceRequired

Application

PATCH /Applications/{uuid}

title, url

Reference

PATCH /References/{uuid}

name, url

Error Handling

  • Concurrent Modification: Another user has modified the entity since you retrieved it.
    {
      "error": {
        "code": "412",
        "message": "Precondition Failed - Entity was modified by another user"
      }
    }

    Solution: Retrieve the entity again to get the latest ETag and retry the operation.

  • Missing ETag: You forgot to include the If-Match header.
    {
      "error": {
        "code": "428", 
        "message": "Precondition Required - If-Match header is required"
      }
    }

    Solution: Include the If-Match header.

Deep Update Restrictions

The API does not support deep updates of nested entities through parent entity endpoints. For example, this does not work:
PATCH /ManualTestCases/{uuid}
{
  "title": "New Title",
  "toActivities": [
    {
      "uuid": "activity-uuid",
      "title": "Updated Activity Title"
    }
  ]
}
Instead, use dedicated endpoints:
PATCH /Activities/{activity-uuid}
{
  "title": "Updated Activity Title"
}

Best Practices for ETag Updates

  • Always retrieve before updating. Get the latest ETag to avoid conflicts.

  • Handle 412 errors gracefully. Implement retry logic for concurrent modifications.

  • Use dedicated endpoints. Update nested entities through their specific endpoints.

  • Validate the ETag format. Ensure the modifiedAt timestamp is properly formatted.

  • Consider user experience. Inform users when their changes conflict with others.