Citrus variable data extract in Java

classic Classic list List threaded Threaded
2 messages Options
Art
Reply | Threaded
Open this post in threaded view
|

Citrus variable data extract in Java

Art
Hi,
I'm trying to extract value from variable but no one solution found Citrus doc and even uncle google works.

Even the one described here:

http://citrus.895196.n3.nabble.com/How-can-I-use-a-citrus-variable-in-Java-code-td4022939.html

ends with error - even exactly the same example copied by copy-paste to test class throws:

"
com.consol.citrus.exceptions.CitrusRuntimeException: Unknown variable 'name'
"
I used some bypass - but still trying to get solution for above as in some situations it can be the only way to provide values from variables outside (in differ way than just using them in echo or other string-like-functions.

Reply | Threaded
Open this post in threaded view
|

Re: Citrus variable data extract in Java

Christoph Deppisch
Administrator
Just use the test context to read and write test variables

testContext.setVariable("someName", "This is a new variable value");

testContext.getVariable("someName");