CI/CD Integration

Int4 Suite APITester allows for integration, using the REST API, of the test execution features in the CI/CD processes, by exposing test execution API usable from CI/CD scripts. It also supports basic iFlow Integration Package actions integration in the CI/CD scripts, by exposing in a convenient way the relevant SAP CI APIs for Integration Package management.

CI/CD example template script and usage

Int4 released example projects that showcase the below functionality in a SAP CI testing scenario

The example project supports the following CI/CD scenario steps:

  • A Git Merge to the development branch (configured as $BRANCH_DEV) triggers capture of integration package specified by $CPI_PACKAGE as ZIP file into the repository

  • A Git Merge to the testing branch (configured as $BRANCH_TEST) triggers test execution before commiting the merge

  • A Git Merge to the release branch (configured as $BRANCH_RELEASE) triggers deployment of the integration package from the ZIP file from the repository

Configuring the example

The example project above needs to be configured

  1. .gitlab-ci.yml file contents need to be updated to reflect Your CI template repository, if You need Your own specifics to be supported

  2. Project CI/CD variables needs to be configured, according to the documentation in CITemplates project README file.

Testing features

image-20240904-105400.png
CI/CD Testing Flow with Int4 Suite

Int4 Suite APITester REST API exposes functions to execute tests and fetch results of their execution, based on Test Case or Test Scenario ID. Please see more details about the API usage in the REST API documentation.

Example cUrl call for a CI/CD script for test execution

The below example uses script-wise variables and generic JSON template to execute a test case from a CI/CD script and returns a value result based on successful execution of the simple test case.

This script takes care about the CSRF token handling, as requested by the REST API.

curl -u "$INT4CRED1:$INT4CRED2" -c cookies.txt -I -X GET https://$INT4HOST/Int4Suite/testcases/$INT4TEST -H "X-CSRF-Token: fetch" > session.txt token=$(cat session.txt | grep csrf | awk '{print $2}') echo {\"DATA\": {\"TEST_CASES\": [ \"$INT4TEST\"], \"EXECUTION_LANDSCAPE\": \"DEV\"}} > test.json curl -u "$INT4CRED1:$INT4CRED2" -X POST https://$INT4HOST/Int4Suite/testruns -d @test.json -H "X-CSRF-Token: $token" -b cookies.txt > result.json cat result.json | grep 'PASSED":1'

Additional SAP CI Specific features

To help organizations utilize CI/CD flows for SAP CI iFlow testing and deployment, Int4 Suite provides a landscape bridge service that proxies the SAP CI API’s

iFlow Capture

image-20240904-105527.png
iFlow Capture flow

iFlow Deployment

Above flows rely on the APIs provided by SAP Cloud Integration, which are documented here in the SAP Business Accelerator Hub

These APIs are proxied by Int4 Suite APITester via the /CICD/$CPI_ENV/ URL path, where $CPI_ENV is a variable representing the environment key as defined in Int4 Suite Configuration.

For example, if You have a CPIDEV environment configured in Int4 Suite, accessible over the internet with HTTPS protocol under the domain name int4.host.name, then the URL to access the IntegrationPackages API will be: https://int4.host.name/CICD/CPIDEV/api/v1/IntegrationPackages

Example code using these SAP CI APIs for Integration Package management can be found in the CI/CD Template Script published by Int4 AG.

© 2017 - 2022 Int4 AG All rights reserved