-
Notifications
You must be signed in to change notification settings - Fork 490
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
Run entry when it matches some condition? #3300
Comments
Hi @iredmail Could you use skip option on some requests (by inverting some logic)? |
Hi @jcamiel, Thanks for the reply.
A |
FYI: An "if" was asked twice when I did my Hurl talk |
Unfortunately I'm trying to do a dynamic skip and I depend on knowing if an entry exists. Then I perform a search (GET) and do a capture. And then it would execute an insertion (POST) if the GET does not return a result. However, capture only supports query and filter, and none of the filters have the ability to return true or false. The solution in my opinion would be to easily add a toBool filter similar to toInt that allows you to convert non-zero values to true and zero to false. Or the more precise solution would be for captures to support the predicate generating a boolean variable that can be used in skip. With dynamic repeat and skip working correctly I don't see any need for if/else and for loops |
Hi @marcodpt We can implement a
I think we get the use case, we just need to find something that is not completely alien from the current model. |
Hi @jcamiel, Thank you very much for your comment. If captures supports predicates, we have assertions and captures with an absolutely identical syntax. The advantage is that it is possible to generate Boolean expressions to use in skip. And another advantage is that it simplifies the syntax of .hurl files as captures and assertions will be absolutely identical. This allows me to do this:
Note that in this case captures and assertions have identical syntax and that only the isEmpty predicate was moved from your example The toBool filter proposal was just a hack if it was not feasible to change the parser syntax. I want to make it very clear that I am extremely grateful for your work and these are just opinions to improve the hurl even further. Take as much time as necessary and prioritize the stability and correctness of the hurl. |
Can we support
|
Problem to solve
Our application supports MySQL and OpenLDAP backends, there're few differences between them, we'd like to run certain hurl entries when it's using X backend. I didn't find condition support in hurl document.
Proposal
Any plan to support such conditions in hurl so that we don't need to handle it with shell script?
Like Ansible, use
when:
: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_conditionals.html#basic-conditionals-with-whenAnd hurl:
The text was updated successfully, but these errors were encountered: