Codeless Sequential Runs — Web to Mobile & Mobile to Web Using API

Overview:

Our Codeless Automation platform allows you to perform seamless sequential test executions between Web and Mobile (Android/iOS) or vice versa using API-based triggers.

For example:

  • You can execute a Web test suite and, upon completion, trigger a Mobile test suite automatically.

  • Similarly, you can trigger a Web test suite after completing a Mobile test suite.

This capability provides flexibility to manage end-to-end (E2E) scenarios effortlessly without manual intervention.

How It Works :

  • You can select Web or Mobile versions inside your project.
  • Add Custom Expressions or Test Functions as part of your test case steps.

  • Use an API call as the final step to trigger the next test suite (Web → Mobile or Mobile → Web).

  • Trigger these runs using information from your project CI Settings.

Web to Mobile Sequential Runs:

Step 1: Steps to Configure

  • Write Your Web Test Case:
    • Design all your test steps using Codeless.

    • In the last step, use a Custom Expression to trigger the Mobile suite via API.

Step 2: How to Get CI Information:

    • Navigate to the Codeless section in your project.

    • Click on Versions.

    • Locate the “i” (Info) button at the top-right corner.

    • Click it to find required tokens and details for API usage.


Step 3: API to Trigger Mobile Run:

API Endpoint:  https://{your_base_url}.testgrid.io/ci/app_build_run

curl --location 'https://{your_base_url}.testgrid.io/ci/app_build_run' \
  --header 'Cookie: _testgrid=YOUR_SESSION_COOKIE' \
  --form 'user_token="YOUR_USER_TOKEN"' \
  --form 'application_token="YOUR_APPLICATION_TOKEN"' \
  --form 'version_token="YOUR_VERSION_TOKEN"' \
  --form 'version_module_id="YOUR_VERSION_MODULE_ID"' \
  --form 's_device="DEVICE_ID"' \
  --form 'process_type="oaa"' \
  --form 'bundle_identifier="YOUR_BUNDLE_ID"' \
  --form 'app_build_id="APP_BUILD_ID"' \
--form 'tags="pipelines"'   # Optional: Run specific tagged test cases

Note:

  • tags parameter is optional — use it to run specific test cases inside the version.

  • bundle_identifier refers to the target app (default or pre-installed).

Mobile to Web Sequential Runs :

Steps to Configure:

  • A similar process, with minor API changes to support the Mobile to Web flow.

API Endpoint:
https://{your_base_url}.testgrid.io/ci/app_build_run

 

cURL Example:

curl --location 'https://{your_base_url}.testgrid.io/ci/app_build_run' \
    --header 'Cookie: _testgrid=YOUR_SESSION_COOKIE' \
    --form 'user_token="YOUR_USER_TOKEN"' \
    --form 'application_token="YOUR_APPLICATION_TOKEN"' \
    --form 'version_token="YOUR_VERSION_TOKEN"' \
    --form 'version_module_id="YOUR_VERSION_MODULE_ID"' \
    --form 's_device="DEVICE_ID"' \
    --form 'process_type="ow"' \
    --form 'test_website_url="YOUR_WEB_URL"' \
  --form 'tags="pipelines"'   # Optional: Run specific tagged test cases

 

Example Java Code Snippet (Web to Mobile Trigger):

OkHttpClient client = new OkHttpClient();
              MultipartBody body = new MultipartBody.Builder()
              .setType(MultipartBody.FORM)
              .addFormDataPart("user_token", "YOUR_USER_TOKEN")
              .addFormDataPart("application_token", "YOUR_APPLICATION_TOKEN")
              .addFormDataPart("version_token", "YOUR_VERSION_TOKEN")
              .addFormDataPart("version_module_id", "YOUR_VERSION_MODULE_ID")
              .addFormDataPart("s_device", "DEVICE_ID")
              .addFormDataPart("process_type", "oaa")  // As per your version configuration
              .addFormDataPart("app_build_id", "APP_BUILD_ID")
              .addFormDataPart("tags", "pipelines")    // Optional
              .build();
              Request request = new Request.Builder()
              .url("https://{your_base_url}.testgrid.io/ci/app_build_run")
              .header("Cookie", "_testgrid=YOUR_SESSION_COOKIE")
              .post(body)
              .build();
              try (Response response = client.newCall(request).execute()) {
                System.out.println("API Response Code: " + response.code());
                System.out.println("API Response: " + response.body().string());
              } catch (Exception e) {
                e.printStackTrace();
              }

 

Adding API Call in Codeless Test Case:

  1. Select the Web or Mobile version inside your project.

  2. Edit the last step of the test case.

  3. Add a Custom Expression with the API call logic.

  4. You can use Maven dependencies if required.

 

As per the script tried below, imports and Maven dependency

import okhttp3.MultipartBody;
                        import okhttp3.OkHttpClient;
                        import okhttp3.Request;
                        import okhttp3.RequestBody;
                      import okhttp3.Response

 

<dependency>
      <groupId>com.squareup.okhttp3</groupId>
      <artifactId>okhttp</artifactId>
      <version>4.12.0</version>
    </dependency>

Refer to the detailed “How to add imports and custom libraries” :
https://testgrid.io/docs/document/add-a-import-statements-and-custom-libraries-in-version-suites/

Verifying Sequential Run:

  • After executing the first suite, check logs for API response.

  • Logs will display the triggered Build ID for the next run.

  • You can track both runs under your project’s Results section.

Scenario

Final Step Required

API process_type

Notes

Web to Mobile

Custom Expression with Mobile Run API

oaa

Use app_build_id or bundle_identifier for app details

Mobile to Web

Custom Expression with Web Run API

ow

Use test_website_url for web URL

Happy Testing !!

Table of Contents