Skip to content

Error: Duplicate request initiated. #96

Answered by ASaiAnudeep
vladparl asked this question in Q&A
Discussion options

You must be logged in to vote

How to send 2 or more requests in one scenario?

To send more requests in a single scenario, just re-initiate the spec object in the appropriate step definition.

When(/^I make a (.*) request with body to (.*)$/, function (method, endpoint, body) {
  spec = pactum.spec();
  spec.withMethod(method);
  spec.withPath(endpoint);
  spec.withBody(body);
});

More details here

How to get stored value from variable data.email and use in second scenario as email parameter?

Use data stores.

Scenario: Get A User
    Given I make a GET request to /api/users/1
     When I receive a response
     Then I expect response should have a status 200
      And I store response at data.email as UserEmail

Sce…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@vladparl
Comment options

Answer selected by ASaiAnudeep
Comment options

You must be logged in to vote
2 replies
@leelaprasadv
Comment options

@ASaiAnudeep
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants