question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FEATURE REQUEST] Edit requests programmatically in Unit Tests (e.g. query variables, request body, headers, ...) #4482

See original GitHub issue

I am testing my login endpoint in Insomnia Designer with the integrated test tool.

A successful login test looks like this with the selected login request:

const response = await insomnia.send();
const body = JSON.parse(response.data);

expect(response.status).to.equal(200);
expect(body).to.have.property("token");

Now I want to change the test with invalid credentials in order to check for a response.status 401.

How can I change the payload I send in a test programmatically so that I can send invalid credentials?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
filfreirecommented, Jul 25, 2022

Hi @sebastianbuechler, we are cataloguing this feedback to try and come up with a feasible plan to improve the test feature completely.

@MrStanDu33 regarding the stalled PR #2994, we will probably not look at it anytime soon, but we’ll update you and the other folks if we do end up kicking off the improving test feature work after we finish other big chunks of work we have in progress (WebSockets support, better login, …). Sorry for the stall, the team is aware the Test feature hasn’t really been a priority in a while, so it’s a bit of a such is life situation right now 😅 🤷

Feel free to report any issues or ideas for improvements you come across in the meantime! Also I’d encourage any of you to drop by and join us on our weekly Insomnia Stream (see details on #stream channel over at https://chat.insomnia.rest/, happens every Tuesday at 14:30 UTC), and share more ideas you’d like to see in Insomnia

2reactions
dimitropouloscommented, Mar 31, 2021

re: timelines just want to say I appreciate the feedback and we’re doing the best we possibly can at the moment especially with so many releases recently. I, along with others from the core team, have been trying quite hard recently to get caught up with many of the issues/PRs that are open right now - but it’s a long process.

Thanks again

Read more comments on GitHub >

github_iconTop Results From Across the Web

Edit requests programmatically in Unit Tests (e.g. query ...
I realized I can invoke another API like below, however, is there a way to send in query variables data dynamically? const response2...
Read more >
Programatically change the request body in Postman - YouTube
Mutating the request body in Postman is something that many people need when building complex requests. Until April 2021 it was not possible ......
Read more >
How to programmatically change the request method in ...
If you need to reuse the same request with different HTTP request methods, there is a solution. Postman lets you define custom methods....
Read more >
Unit Testing Controllers in ASP.NET Web API 2 - Microsoft Learn
Here are some things that you should unit test in your Web API controllers: The action returns the correct type of response. Invalid...
Read more >
Unit Testing | Insomnia Docs
Create a Test Suite · Import and select your OpenAPI Specification as a Design Document. · Click the Debug tab to ensure that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found