Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The below table summarizes how a Postman API Tests gets translated to an AIO Case.

Postman field

AIO Tests Field

Example

Name of request

Title

PublicApi - Get TestCase Priority

Name of request

Automation key

PublicApi - Get TestCase Priority

Request endpoint

First step in Given

GET {{SERVER_URL}}/project/{{JIRA_PROJECT_ID}}/config/testcase/priority

Query Params

Data in first step

Query: startAt=0&maxResults=100&needDataInRTF=true

Body params

Data in first step

{"testRunStatus": "Passed<b>NR</b>1", "effort": 180, "comments": ["Comment line1", "Comment line2"] }

Form Data

Data in first step [FormData:
key1 = value1

key2=value2]

FormData: file = "/file.json"
cleanResults = true
fetchDetails = true

URL Encoded Body

Data in first step [ URLEncoded: key = value ]

URLEncoded: what = for

Headers

No mapping

 

First assertion (if any)

Step 2 with Then keyword

THEN Response must be valid and have a body

Rest of the assertions

Step 3 and forth with And as keyword

AND Validate Priorities in Response

Reponse size, response code, response time

Actual result of first step

 

Variable values [ Env, collection ]

Actual result of first step

 

Request Error [ happens when server URL is invalid]

Actual result - against first step

RequestError{ errno=-3008, code='ENOTFOUND', syscall='getaddrinfo', hostname='{{cloud url}}'}

Assertion Failures

Actual result

AssertionError: expected response to have status reason 'OK' but got 'UNDEFINED' at Object.eval sandbox-script.js:1:1)

Mapping Postman Tests to Existing AIO Tests

...

AIO Tests has introduced a custom reporter for Newman. The newman-reporter-aiotests simplifies reporting results from Newman with an easy setup.

Install

The reporter works as a plugin with Newman so ensure that you have already installed that package globally, using npm install -g newman.

To globally install the aiotests package:

Code Block
npm install -g newman-reporter-aiotests

To use aiotests as a library, install the package as a dependency into a nodejs project's package.json file using:

Code Block
npm install -S newman-reporter-aiotests

Usage

In order to enable this reporter, specify aiotests in Newman's -r or --reporters option. The following command would run the reporter:

Code Block
newman run collection.json -r aiotests 
--reporter-aiotests-jiraProjectId=AUT --reporter-aiotests-aioApiToken=<yourAPIToken>

CLI Options

With Newman CLI

...

CLI Option

...

Description

...

Example

...

--reporter-aiotests-enableReporting

...

To enable or disable reporter for a particular run. Defaults to true.

...

newman run collection.json -r aiotests --reporter-aiotests-enableReporting=false

...

--reporter-aiotests-enableReporting

...

To enable or disable reporter for a particular run. Defaults to true.

...

newman run collection.json -r aiotests --reporter-aiotests-enableReporting=false

...

--reporter-aiotests-jiraProjectId

...

Jira Project key - the Jira project to which the results need to be reported

...

newman run collection.json -r aiotests --reporter-aiotests-jiraProjectId=AUT

...

--reporter-aiotests-aioApiToken

...

Only for Jira Cloud
API Token generated from AIO Tests.

...

newman run collection.json -r aiotests --reporter-aiotests-apiToken=<yourapitoken>

...

--reporter-aiotests-jiraServer

...

Only for Jira Server/DC
Hosted Jira Server URL

...

newman run collection.json -r aiotests --reporter-aiotests-jiraServer=https://myhostat.myco.com

...

--reporter-aiotests-jiraPat

...

Only for Jira Server/DC
Personal Access Token generated from Jira Server

...

newman run collection.json -r aiotests --reporter-aiotests-jiraServer=https://myhostat.myco.com --reporter-aiotests-jiraPAT=<yourPAT>

...

--reporter-aiotests-createNewCycle

...

Set to true to create new cycle for run.

...

newman run collection.json -r aiotests --reporter-aiotests-createNewCycle=true

...

--reporter-aiotests-cycleKey

...

If createNewCycle is false, then the cycleKey identifies the existing AIO Tests Cycle to be updated

...

newman run collection.json -r aiotests --reporter-aiotests-cycleKey=AUT-CY-23

...

--reporter-aiotests-newCycleTitle

...

If createNewCycle is true, the newCycleTitle specifies the name of the cycle to create

...

newman run collection.json -r aiotests --reporter-aiotests-newCycleTitle="API Smoke Run 24Nov"

...

--reporter-aiotests-createNewRun

...

Defaults to false. Set to true to create a new run for each execution.

...

newman run collection.json -r aiotests --reporter-aiotests-createNewRun=false

...

--reporter-aiotests-createCase

...

Defaults to true. Set to false, if cases without case Key mapping should be reported as failures.

...

newman run collection.json -r aiotests --reporter-aiotests-createCase=false

...

--reporter-aiotests-bddForceUpdateCase

...

Defaults to true. Set to true to override data from report to overwrite the manual case in AIO Tests. Set to false, if case should not be updated. e.g If a new assertion is added in Postman, if bddForceUpdateCase is true, it would be added as a new step, else it would be reported as failure.

...

newman run collection.json -r aiotests --reporter-aiotests-bddForceUpdateCase=false

With Newman as a Library

All the CLI functionality is available for programmatic use within a nodejs script.

Install the required node modules using npm i -S newman newman-reporter-aiotests

Code Block
const newman = require('newman');

newman.run({
   collection: '/path/to/collection.json',
   reporters: 'aiotests',
   reporter: {
     aiotests: {
        //enableReporting controls, if for this run, results have to be reported or not
        'enableReporting': true, 
        
        // Jira Project Key
        'jiraProjectId': 'PROJ1', 
        
        // Uncooment below : Jira Server URL and Jira PAT is required if on Jira Server/DC
        // 'jiraServer': 'https://jira8.aioreports.com', 
        // 'jiraPat': '<PATToken>', 
        
        //AIO Tests API Key
        'aioApiToken': '<AIO API Key>',
        
        //createNewCycle - defaults to true, Set to true if new cycle needs to be created
        'createNewCycle': false, 
        
        //newCycleTitle - defaults to collection name, if createNewCycle true, newCyclePrefix would be used to create new cycle, else cycleKey would be used to update existing cycle
        'newCycleTitle': '',
        
        //cycleKey - if createNewCycle is false, then set cycleKey to report to existing cycle
        'cycleKey': 'NVTES-CY-403',
        
        //createNewRun - defaults to false, set to true to create new run for each execution
        'createNewRun': true, 
        
        //createCase - defaults to true, Set to false, if new cases should not be created for requests with no cake key mapped
        'createCase': true, 
        
        //bddForceUpdateCase - defaults to true, updates step changes in AIO Case with changes in request data
        'bddForceUpdateCase': true 
     }
   }
});

 Please refer to Newman AIO Tests Reporter for instructions on installation and usage.

For further queries and suggestions, feel free to reach out to our customer support via help@aiotests.com.