Monday, January 31, 2022

Setup Allure in Windows 10 and Generate Allure Report

  1. Download the latest allure framework from the below link - https://github.com/allure-framework/allure2
  2. Set the allure bin path
  3. Open the CMD and check the allure version by entering 'allure --version'
  4. Run the test cases
  5. Open the CMD and run the following command to generate the allure report - 'allure serve D:\Learnings\Project\build\allure-results'
  6. Automatically the report will be opened


To run a cucumber test using Gradle -
.\gradlew.bat test --tests RunTests




Thursday, January 6, 2022

How to set the generated token as an Environment Variable in Postman Tool

Generated Token Response -

{
    "data": {
        "authToken": {
            "getToken": {
                "accessToken""b1hXMCJ9.eyJhdWETQ1NTk2NSwiYWlvIjoiCJhcHBpZCI6IjQ1ZTMA"
            }
        }
    }
}

Use the below code snippet to set the generated token as an environment variable in Postman Tool

Paste the below code in the Test tab (Please modify the code according to your response).
Environment Variable: token (Use this variable across the API's)

Example: In headers - Authorization : {{token}}


var responseObject = JSON.parse(responseBody);

if (responseObject && responseObject.data && responseObject.data.authToken && 
responseObject.data.authToken.getToken  && responseObject.data.authToken.getToken.accessToken)
{
    postman.setEnvironmentVariable("token"`Bearer ${responseObject.data.authToken.getToken.
                                                            accessToken}`);
}

Thanks for watching this space.