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

Does hurlfile support skip semantics? #1815

Closed
jcamiel opened this issue Aug 4, 2023 Discussed in #1810 · 10 comments
Closed

Does hurlfile support skip semantics? #1815

jcamiel opened this issue Aug 4, 2023 Discussed in #1810 · 10 comments
Labels
enhancement New feature or request
Milestone

Comments

@jcamiel
Copy link
Collaborator

jcamiel commented Aug 4, 2023

Discussed in #1810

Originally posted by chenrui333 August 2, 2023
I am curious if I can skip the test cases in the hurlfile or skip the entire file.

@jcamiel jcamiel added the enhancement New feature or request label Aug 4, 2023
@jcamiel jcamiel added this to the 4.2.0 milestone Oct 4, 2023
@egoarka
Copy link

egoarka commented Oct 16, 2023

Any thoughts about implementing it as priority option?

[Options]
priority: skip # skips only this test
priority: only # runs only this test

while for conditional test run, Test section might be added (might act as Asserts, but runs before test).

DELETE {{host}}/users/{{user_uuid}}
Authorization: Bearer {{access_token_admin}}
[Test]
captures {{user_uuid}} exists

or there is a way to make global variables and then combined with Test section:

GLOBAL
[Variables]
priority: only
test_token: 123
secret_token: ${SECRET_TOKEN} # env variable

GET http://localhost:8000/{{test_token}}

GET http://localhost:8000/2
[Test]
priority: only

@fabricereix
Copy link
Collaborator

Hi @egoarka,
I normally see a priority semantic with a numeric/increasing value.

What exactly is your case? You want to execute only one entry?
we currently have --to-entry option, we could also naturally add --from-entry
and thus, it would possible to execute only one entry.

@egoarka
Copy link

egoarka commented Oct 16, 2023

I normally see a priority semantic with a numeric/increasing value.

Yeah, I thought that way at first and added example with numeric values, but changed my mind and deleted as it would be a bit more complex, although I didn't think of better name.

What exactly is your case? You want to execute only one entry?

only one, or skip specific entries and run rest

@fabricereix
Copy link
Collaborator

Maybe --entries 2,4
It is similar to specifying pages when printing a document.

@egoarka
Copy link

egoarka commented Oct 16, 2023

That might work too, also what about declarative way of specifying it in hurl file? (this is helpful if you have multiple tests around in single file and you want to work on specific test, and don't mess around with rest or simply remember order of tests )

@fabricereix
Copy link
Collaborator

that's where you would use the skip option.

GET {{url1}} 

GET {{url2}}
[Options]
skip: {{skip}}

GET {{url3}}

GET {{url4}}
[Options]
skip: {{skip}}
hurl --variable skip=true test.hurl

The entries 2 and 4 will be skipped.

@egoarka
Copy link

egoarka commented Oct 16, 2023

yeah, that works, but what if I have a ton of tests and I wanna run only the one in the middle (or few along with it, but exclude rest), should I manually just find it's index/indexes and run with --to-entry option? (this is why I decided to go with priority at first place in terms of specifying it in a declarative way, might act in both ways, but naming might be misleading)

GET {{url1}} 

GET {{url2}}
[Options]
priority: {{skip}}

GET {{url3}}
[Options]
priority: {{only}}

GET {{url4}}
[Options]
priority: {{skip}}

hurl --variable only=only test.hurl

Runs only 3rd test. 1st should not run along with 3rd because it has undefined priority.
But in case of hurl --variable skip=skip test.hurl it's fine and 1st and 3rd tests should run.
If priority is not specified or undefined, then all tests should run.

@fabricereix
Copy link
Collaborator

We also thought before about adding a --to-line-number, similar and probably easier to use than --to-entry for large Hurl file

@egoarka
Copy link

egoarka commented Oct 16, 2023

But if let's say you add test above, test below, you should always keep in mind you have to use new line number to make it work, labeling specific tests might be better, so you just remember name of it and run it

@fabricereix fabricereix linked a pull request Oct 21, 2023 that will close this issue
@jcamiel jcamiel closed this as completed Oct 21, 2023
@jcamiel
Copy link
Collaborator Author

jcamiel commented Oct 21, 2023

@egoarka landing on master, you can use now skip:

GET https://foo.com

GET https://bar.com
[Options]
skip: true

GET https://baz.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants