Orange-OpenSource / hurl

Hurl, run and test HTTP requests with plain text.
https://hurl.dev
Apache License 2.0
12.94k stars 484 forks source link

Run entry when it matches some condition? #3300

Open iredmail opened 6 days ago

iredmail commented 6 days ago

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-when

tasks:
  - name: Shut down Debian flavored systems
    ansible.builtin.command: /sbin/shutdown -t now
    when: ansible_facts['os_family'] == "Debian"

And hurl:

POST {{server}}/domain/abc.io
WHEN: my_variable=my_value

HTTP 200
[Asserts]
...
jcamiel commented 6 days ago

Hi @iredmail

Could you use skip option on some requests (by inverting some logic)?

iredmail commented 5 days ago

Hi @jcamiel,

Thanks for the reply.

A when: like Ansible might be a lot easier. :)