java - Setting variables and expected values in Citrus Framework -
i have following scenario want test:
- perform call service a, number of elements in jsonarray
- call service b perform given action
- perform call service again, verify jsonarray has new element on it
ps: there no correlation between service b call in step 2 , verification in step 3. can verify element count increased in 1.
- i can perform step 1 using citrus
http()
,.extractfrompayload()
, add variable - i can perform step 2
http()
call
however stuck @ step 3, since can't modify value of variable taken in step 1. have tried using action(new abstracttestaction() {...})
don't happen in between test not working.
is there way of accomplishing this?
i've adapted solution citrus framework - can variable assigned response?. able accomplish via:
adding step test (before making step 3 above):
groovy(new classpathresource("addvariable.groovy"));
this content of addvariable.groovy
int expected = context.getvariable("currentdataxyz").tointeger() + 1 context.getvariables().put("expecteddataxyz", expected.tostring())
i think bit cumbersome, works! if there cleaner way of doing it, nice, or maybe feature request :)
wiki
Comments
Post a Comment