yaks icon indicating copy to clipboard operation
yaks copied to clipboard

How to log/print variable?

Open Duvel opened this issue 3 years ago • 1 comments

According to the documentation it seems possible to log variables, but with yaks 0.12 I'm not able to get it to work.

https://citrusframework.org/yaks/reference/html/index.html#steps-variables

I tried with single quotes, but it then logs everything as text and yaks doesn't resolve the variable.

When I try this:

    Given variable datetime is "citrus:currentDate('yyyyMMddHHmmss')"
    Given variable corrMessageId is "MESSAGE-${datetime}"
    Then print "CorrMessageId: ${corrMessageId}"

I get an error like:

[ERROR]   Run 1: The step 'print "CorrMessageId: ${corrMessageId}"' is undefined.
You can implement this step using the snippet(s) below:

@Then("print {string}")
public void print(String string) {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
}

Duvel avatar Oct 27 '22 09:10 Duvel

It is definitely single quotes that you should be using. And YAKS should be able to resolve the variable.

Please make sure to enable the logging level INFO. By default the level is ERROR

You can set the logger in CLI options like this:

yaks run mytest.feature --logger root=INFO

christophd avatar Dec 13 '22 14:12 christophd