venom icon indicating copy to clipboard operation
venom copied to clipboard

Setting vars value with result of a step does not seem to evaluate

Open 1am opened this issue 11 months ago • 6 comments

Hello, I'm using Version v1.1.0 and needed to use the feature documented in vars.yml test. It wasn't working for me in my test so I coped the test testcase and it also fails with the following

$ venom run vars.yml -vvvv
	  [trac] writing venom.12.log
 • Variables testsuite (vars.yml)
 	• CreateService
 		• exec PASS
	  	  [trac] writing vars.CreateService.step.0.0.dump.json
 	• WriteServiceIdForNextTestSuites
 		• exec PASS
	  	  [trac] writing vars.WriteServiceIdForNextTestSuites.step.0.0.dump.json
 	• echo_myvar
 		• exec FAIL
 		  Testcase "echo_myvar", step #0-0: Assertion "result.systemout ShouldContainSubstring foo" failed. expected '{{.myvar}}' to contain 'foo' but it wasn't (vars.yml:34)
	  	  [info] {{.myvar}} (vars.yml:30)
	  	  [trac] writing vars.echo_myvar.step.0.0.dump.json
final status: FAIL

What am I doing wrong and is there a way to work around this? I need to pass an ID from one step into bodyfile of a subsequent step which posts a JSON file which includes ID. I hoped to use the vars.yml test mechanism for this.

1am avatar Mar 08 '24 13:03 1am

The feature works but the example seems broken. Can you share your test to see what you are doing wrong ?

FloRichardAloeCorp avatar Mar 11 '24 12:03 FloRichardAloeCorp

My example was somewhat more specific version of vars.yml but even if it would work it would help. In the end what I was aiming at (out of scope of this issue I guess) was similar to tests/http_post_bodyfile.yaml in which my template file placeholders would be populated with values set after first step of the test.

1am avatar Mar 11 '24 14:03 1am

@1am Have you tried version https://github.com/ovh/venom/releases/tag/v1.2.0-beta.4

New changes to vars

ivan-velasco avatar Mar 13 '24 16:03 ivan-velasco

Just tried updating to 1.2.0-beta.4 and the result is the same: Testcase "echo_myvar", step #0-0: Assertion "result.systemout ShouldContainSubstring foo" failed. expected '{{.myvar}}' to contain 'foo' but it wasn't (vars.yml:34) when running vars.yml

1am avatar Mar 18 '24 07:03 1am

Hi @1am , can you provide a full reproducer please?

yesnault avatar Mar 28 '24 10:03 yesnault

Hello @yesnault The full reproducer was an exact copy of vars.yml without any changes.

1am avatar Mar 30 '24 06:03 1am