How to iterate over a vector

Hi there

I am trying to iterate over a vector with a foreach, but I get this error

14:14:31.797 [ERROR] i.g.c.s.LoopBlock$ - Condition evaluation crashed with message ‘Can’t cast value 463bd5f1-caee-47e0-beba-551e47c008d3 of type class java.lang.String into interface scala.collection.Seq’, exiting loop

The code looks like this

.exec(http("Get tickets")
.get("/tickets_updated?start=0")
.check(status.is(200))
.check(jsonPath("$.updated[*]").findAll.saveAs("updatedTickets")))

Hi,

you’re using the same name for both the list of tickets and the session variable that will hold each ticket, which means that as soon as one enter the foreach, the list is lost and has been overwritten.
Simply use a different name for the element and it’ll work.

Cheers,

Pierre

Thank you so much, that was it! The error message sent me through to a very different path.

just to clarify, the error makes sense. Seems pretty obvious now that I see what was going on :slight_smile: