mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[GH-ISSUE #3184] [feature]: Access to environment in Tests #1049
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#1049
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @koehler0179 on GitHub (Jul 13, 2023).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3184
Is there an existing issue for this?
Summary
Would be nice if it would be possible to access the environment variables in the tests as it is possible in Postman.
Why should this be worked on?
Sometimes you have multiple requests where the next request uses a value of the result from the previous request. Currently if trying to set an environment variable in a test ends up with an error running the test.
pw.env.set("myVar", "some value");
@liyasthomas commented on GitHub (Jul 15, 2023):
Hi @koehler0179, can you share the error logs when you ran the Test scripts?
Hoppscotch Test scripts have support for environment context and can add, append and edit environment variables from test scripts. Documentation: https://docs.hoppscotch.io/documentation/features/scripts#pwenvgetvariable
@koehler0179 commented on GitHub (Jul 17, 2023):
Okay, my fault. Value always has to be converted to string to work. Tried to set a bool and that was throwing an error.
pw.env.set("myVar", true);
or:
pw.env.set("myVar", 1);
Would be nice to have an any type as value that is internal converted to a string.