Latest post from this blog

How to Manage Test Execution Across Different Browsers and Environments (QA, UAT, Staging)

In real-time automation projects, test execution is never limited to a single browser or a single environment . Applications must be validated across multiple browsers (Chrome, Firefox, Edge) and multiple environments such as QA, UAT, and Staging before going live. A well-designed Selenium + Java + Cucumber automation framework should allow testers to switch browsers and environments easily without changing test scripts . This blog explains how to manage test execution efficiently across different browsers and environments using best practices followed in real projects. Why Multi-Browser and Multi-Environment Testing Is Important Different users use different browsers QA, UAT, and Staging environments have different configurations Bugs may appear only in specific environments or browsers Same test cases must be validated everywhere before production release Common Challenges Testers Face Hardcoded browser names and URLs Maintaining separate test scripts for each environment Browse...

Use of Dynamic Variables in Datadog Synthetic API Tests

Use of Dynamic Variables in Datadog Synthetic API Tests
In Datadog, Dynamic Variables are placeholders that can be used to reference values obtained from previous steps in your API test or predefined values like timestamp, random values, etc. These can be considered similar to "local variables."  

Steps to Use Dynamic Variables:
1. Create a Synthetic API Test:
   - Go to Synthetic > API Tests in Datadog.  
   - Click on Create Test and select API Test.  

2. Set Up API Test Steps:
   - In the Test Steps, configure the API call you want to test.  
   - You can define various API requests (e.g., GET, POST, PUT, etc.) and set the request headers, body, and parameters.  

3. Use Dynamic Variables:
   - Datadog allows you to use dynamic variables within your API test configuration.  

    Some examples include:  
     - {{uuid}} : Generates a random UUID for use in API parameters or headers.  

     -  {{timestamp}} : Inserts the current timestamp.  

     -  {{random}} : Generates a random number within a specified range. 

Example 1: Using Dynamic Variables with Local Scope

Scenario: send a name field  with a timestamp and another name field with a random 5 - Character string, using them as local variables for a POST request.

Step 1: Dynamic Variables 
In Datadog, you can use Dynamic Variables like {{timestamp}} or {{random}} directly in the API test configuration. These will serve as your inbuilt variables.  Automatically generated by Datadog and can be directly used in test steps.

Step 2: POST Call with name and timestamp

Endpoint:
https://api.createusers.com/user

Request Type:
POST

Header:
{
  "Content-Type": "application/json"
}

Body:

{
  "name": "User_{{timestamp}}",  
  "email": "user_{{timestamp}}@example.com",
  "unique_name": "User_{{random | string(5)}}",
  "role": "test-user"
}

Another way we can add the timestamp, character and numeric etc

Step 1: Create the Local Variables

I will create a local variable named TESTING and assign it the value timestamp. After saving the local variable, I will use the same variable in the POST call.


Body:

{
  "name": "User_{{TESTING}}",  
  "email": "abc@gmail.com"
  "role": "test-user"
}
  • {{timestamp}} will be used to generate a dynamic name with the current timestamp.
  • {{random | string(5)}} will create a 5-character random string to use for unique_name.

Comments

Popular posts from this blog

How to Manage Test Execution Across Different Browsers and Environments (QA, UAT, Staging)

Purpose of the StepData Class in Selenium + Java Cucumber Automation Framework

Ensuring Thread Safety in Parallel Test Execution with Selenium, Cucumber, and Java