0

I tried to validate 2 conditions inside eventually block... something like this

eventually(timeout(Span(26, Seconds)), interval(Span(2, Seconds))) {
        response = executeSomeFunction
        response should be = (true)
        if (response) {
          something = responseResult.get
          something should be >= (10)
        }
      }

What am looking for is eventually should satisfy both the conditions. That is first it should check if response is true and then when response is true, it should validate the condition inside if loop. I tried executing this but am getting error message

ambiguous reference to overloaded definition" referencing to line "response should be = (true)"

Am not sure what I am trying to do is even possible inside eventually or not.

Tzach Zohar
  • 37,442
  • 3
  • 79
  • 85
nname
  • 59
  • 1
  • 9

1 Answers1

0

The problem is that you write

response should be = (true)

But actually you want to write:

response shouldBe true

In your case you make assignment of response should be: ResultOfBeWordForAny[Boolean] to the value true. Not clear what conversion here you expect.

P.S. Also write response = executeSomeFunction outside of eventually block, otherwise it could be executed multiple times.

P.P.S Moreover you don't need eventual call if you test result of your function, it's anyway in the scope. eventually isn't the best practice and used when function have some async side-effects you would like to test.

Nikita
  • 4,435
  • 3
  • 24
  • 44