[GH-ISSUE #1316] Code snippets for Test scripts #431

Closed
opened 2026-03-16 15:17:35 +03:00 by kerem · 4 comments
Owner

Originally created by @liyasthomas on GitHub (Nov 3, 2020).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1316

Is your feature request related to a problem? Please describe.
Post Requests Tests enable us to write and run test scripts after response. As of now, there's no ready-to-use code snippets available for test cases.

Describe the solution you'd like
It would be great if there's a pool of code snippets or Test script with general test scripts.

Example:
Test snippet: Check if response is ok

pw.test('Response is ok', () => {
    pw.expect(pw.response.status).toBe(200);
    pw.expect(pw.response.body).not.toHaveProperty('errors');
})

Describe alternatives you've considered
Go to Wiki and figuring out what and how to write tests.

Additional context
Post request scripts are an experimental / incomplete feature. But has huge potential in terms of testing responses and automating stuffs to an extend. Also helps in integrations with 3rd party apps in future .

Originally created by @liyasthomas on GitHub (Nov 3, 2020). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1316 **Is your feature request related to a problem? Please describe.** [Post Requests Tests](https://github.com/hoppscotch/hoppscotch/wiki/Post-Requests-Tests) enable us to write and run test scripts after response. As of now, there's no ready-to-use code snippets available for test cases. **Describe the solution you'd like** It would be great if there's a pool of code snippets or Test script with general test scripts. Example: Test snippet: `Check if response is ok` ``` pw.test('Response is ok', () => { pw.expect(pw.response.status).toBe(200); pw.expect(pw.response.body).not.toHaveProperty('errors'); }) ``` **Describe alternatives you've considered** Go to [Wiki](https://github.com/hoppscotch/hoppscotch/wiki/Post-Requests-Tests) and figuring out what and how to write tests. **Additional context** Post request scripts are an experimental / incomplete feature. But has huge potential in terms of testing responses and automating stuffs to an extend. Also helps in integrations with 3rd party apps in future .
kerem 2026-03-16 15:17:35 +03:00
  • closed this issue
  • added the
    feature
    label
Author
Owner

@carlos-ds commented on GitHub (Nov 30, 2020):

@liyasthomas I'd like to work on this if that's ok with you. But I'm not sure if you are talking about updating Post Requests Tests with more examples or whether you are talking about incorporating examples into the application itself?

<!-- gh-comment-id:736000168 --> @carlos-ds commented on GitHub (Nov 30, 2020): @liyasthomas I'd like to work on this if that's ok with you. But I'm not sure if you are talking about updating [Post Requests Tests](https://github.com/hoppscotch/hoppscotch/wiki/Post-Requests-Tests) with more examples or whether you are talking about incorporating examples into the application itself?
Author
Owner

@liyasthomas commented on GitHub (Nov 30, 2020):

I was mentioning about adding ready-made script snippets for general testing purposes so that users don't have to write the testing script by themselves. Also I see you've already opened a feature request to add more protocols to testing property in #1353 which is really appreciated. That's a good opportunity there.

<!-- gh-comment-id:736094072 --> @liyasthomas commented on GitHub (Nov 30, 2020): I was mentioning about adding ready-made script snippets for general testing purposes so that users don't have to write the testing script by themselves. Also I see you've already opened a feature request to add more protocols to testing property in #1353 which is really appreciated. That's a good opportunity there.
Author
Owner

@carlos-ds commented on GitHub (Dec 11, 2020):

@liyasthomas I reviewed and updated the Wiki page regarding testing and updated the link at the Wiki index. I committed the changes directly since I read that pull requests aren't supported for Wiki pages. Could you review and let me know if it's ok?

<!-- gh-comment-id:743380489 --> @carlos-ds commented on GitHub (Dec 11, 2020): @liyasthomas I reviewed and updated the [Wiki page regarding testing](https://github.com/hoppscotch/hoppscotch/wiki/Post-Request-Tests) and updated the link at the Wiki index. I committed the changes directly since I read that pull requests aren't supported for Wiki pages. Could you review and let me know if it's ok?
Author
Owner

@liyasthomas commented on GitHub (Dec 11, 2020):

@carlos-ds looks good to me. Thanks.

Also this seems like it's better when sample test scripts are in "Tests Wiki" rather than in "Tests section" in Hopp. Hence closing.

<!-- gh-comment-id:743484413 --> @liyasthomas commented on GitHub (Dec 11, 2020): @carlos-ds looks good to me. Thanks. Also this seems like it's better when sample test scripts are in "Tests Wiki" rather than in "Tests section" in Hopp. Hence closing.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#431
No description provided.