hurl
hurl copied to clipboard
Allow accessing the entry id in test files
Hey, thanks for your work! I think it might be nice to have the ability to access the entry ID inside the hurl test file. E.g.:
#1.hurl
POST /foo
{
"must_be_unique": {{ENTRY_ID}}
}
---EOF---
#2.hurl
POST /foo
{
"must_be_unique": {{ENTRY_ID}}
}
Thus, it could be running as hurl --test *.hurl
It seems similar to https://github.com/Orange-OpenSource/hurl/issues/606. But it looks more simple, cuz it already there: https://github.com/Orange-OpenSource/hurl/blob/802d78359f8015e3487918b42621c1cb8bbd1eea/packages/hurl/src/runner/hurl_file.rs#L99
Also, sequential ID can be handier rather than random in some cases.
Hello @k33nice ,
this is a good idea.
We could have predefined variables available at runtime.
we could access the current entry index with {{self.entry.index}}
or {{entry.index}}
.
We initially though about them to get the current time.
Generating sequential id might also be indeed useful. That might be enough for uniqueness in a test.