Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add context to request execution #1874

Closed
tlaloc911 opened this issue Mar 21, 2024 · 1 comment
Closed

Add context to request execution #1874

tlaloc911 opened this issue Mar 21, 2024 · 1 comment

Comments

@tlaloc911
Copy link
Contributor

tlaloc911 commented Mar 21, 2024

I have the need to know the execution context of the request:

  1. Name of the Request executed
  2. Path of the .bru name
  3. Execution mode: single, runner, cli
  4. Associated documentation of the request

This will allow me to take some decisions in scripts, such as how to name logs, where to find data associated to every request, apply or exclude some tests depending on the way it is launched, etc.

Pre Request script example

console.log("-------- executionMode ----------")
console.log(bru.getVar("executionMode"))
console.log("-------- pathname ----------")
console.log(bru.getVar("currentItem").pathname)
console.log("-------- filename ----------")
console.log(bru.getVar("currentItem").filename)

Outputs

image image image

I am preparing a PR with this solution

@helloanoop
Copy link
Contributor

Hey @tlaloc911 !
I've opened #3817 to facilitate a more detailed discussion about this API.

Closing this issue now—please track updates in #3817.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants