3
Override Environment for Testing a Request in Unit Tests
Source: Kong/insomnia#4626 · opened by @ceagan
If there was a way to provide an Environment JSON Object within a unit test to override other environment values, then it would be possible to create Unit Tests that reuse the same request, altering the call slightly by altering the environment variables referenced in the Request definition. This would make Requests much more useful from the perspective of Unit Tests and reduce the number of Requests required to build out a set of Unit Tests.
Consider a Request stored within a folder that defines the following environment for all Requests in that folder.
A Request in that folder might have a payload that references the date and amount in the environment like this:
The desired feature would enable the unit test to override the date variable in the environment for the duration of the unit test by doing something like this:
In the above example, the unit test would run with the date = "2022-10-10" and amount = "$20".
Consider a Request stored within a folder that defines the following environment for all Requests in that folder.
A Request in that folder might have a payload that references the date and amount in the environment like this:
The desired feature would enable the unit test to override the date variable in the environment for the duration of the unit test by doing something like this:
In the above example, the unit test would run with the date = "2022-10-10" and amount = "$20".
No pledges yet. Be the first to back this.
Comments
Similar requests
Integrate trigger behavior with unit tests
3 votes · 0 comments
GraphQL query variable as input in Unit Test
3 votes · 0 comments
Ability to add folders in test suite
2 votes · 0 comments
Allow access to mocha context from unit tests
3 votes · 0 comments
Allow environment variables in Unit tests
2 votes · 0 comments
No comments yet.