Am 21.11.21 um 10:47 schrieb Vladimir Sitnikov:
>> Can the kotlin templating mechanism be switched off in that case?
> Unfortunately, there's no way to switch it off yet.
> The issue is known as https://youtrack.jetbrains.com/issue/KT-2425
>
>> I don't understand it, can you give an example?
> testPlan {
>     var orderId by variables.regex()
>     http {
>         url = "example.com"
>         extractRegex {
>             storeTo(orderId)
>             // or variable = orderId
>         }
>     }
>     http("example.com/orders/$orderId")
>     http(".../${orderId.random}")
>
> In other words, orderId "allocates" a variable name (e.g. orderIdVar), then
> regex extractor is configured to store the value to "orderIdVar"
> Later, $orderId is Kotlin expression that calls orderId.toString() which
> would return the variable name "orderIdVar"

Given this example I can understand, how $orderId will be rendered to
${orderIdVar} and I think same feature (#toString) can be used to
introduce JMeter functions.

What I don't get yet, is why or how the variables.regex() would be
needed. What would it do at that place? I would understand the
declaration of a general variable, but (at the moment) not a special
regex one. At the same time I fail to understand the usage of
${orderId.random} (probably for the same reason).

With respect to naming `extractRegex`:

 * we are not extracting a regex, but something using a regex. Should we
make that more clear by using something like `extractByRegex`?

 * we have a lot of different extractors, can/should these be made more
unified by using something like `extractor(regex) { storeTo(orderId) ... }`?

>
>> I wanted to ask about the intended usage. How should those possibilities
> map to the elements?
>
> That is the key question :)
> They all will be useful.

>
>> Currently we get the JMeterContext by a static function and everyone
> would get the same context. That is no problem when used inside the GUI,
> but might be a problem, when used by developers in other circumstances
> (and not aware of this)
>
> That is sad indeed, yet it it does not block DSL implementation. It would
> be great to lift that restriction and make JMeter less static in the future.

Yes, it has nothing directly to do with this discussion of a DSL, but I
think it might be more dangerous, when people start using it.

Felix

> Vladimir
>

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to