gwen-interpreter / gwen-web

Web automation engine for Gwen
https://gweninterpreter.org
Apache License 2.0
54 stars 18 forks source link

Issue in until/while dsl #38

Closed pradeep-thawani closed 7 years ago

pradeep-thawani commented 7 years ago

<step> <until|while> <condition>

Repeatedly performs the given step until or while a condition is satisfied, using default delay and timeout periods. The default delay between iterations is one tenth of the configured gwen.web.wait.seconds setting (or 1 second if not set) The default timeout period is 30 times the delay. <step> = the step to repeat <condition> = the name of the bound attribute containing a javascript predicate expression

Above is the dsl definition.

Below works fine:

@StepDef
Scenario: I fetch countvar
    Given countvar is defined in the test1199 database by sql "Select count(*) from progs"
      And countvar > 0 is defined by javascript "${countvar} > 0"

Scenario: A test scenario
    Given I fetch countvar until countvar > 0

But when I instead of comparing countvar with a hard-codded value in the predicate, I compare it with a parameter. Something like this:

@StepDef
Scenario: I compare countvar with <expectedCount>
    Given countvar is defined in the test1199 database by sql "Select count(*) from progs"
      And validateCount is defined by javascript "${countvar} > $<expectedCount>"

Scenario: A test scenario
    Given I compare countvar with 1 until validateCount

In the above case, positive scenario runs successfully but when I try negative scenario, it retries for stated timeout and then displays a message saying that expected condition failed. But the final status of scenario comes as Passed.

PFA output log: UntilFailure.txt

bjuric commented 7 years ago

Hi @pradeep-thawani

Thank you for raising this. I've built a snapshot containing a fix to preserve the propagated evaluation status. Please try it out using the snapshot build below and let me know how it goes.

snapshot build: https://oss.sonatype.org/content/repositories/snapshots/org/gweninterpreter/gwen-web/2.10.0-6-gc895ee6-SNAPSHOT/gwen-web-2.10.0-6-gc895ee6-SNAPSHOT.zip

pradeep-thawani commented 7 years ago

Hi @bjuric The snapshot build works as expected. Thanks.

bjuric commented 7 years ago

Great. Thanks. Delivered in v2.11.0