One of my test chains mimics a step to remove items from a cart.
I’ve implemented it recursively by going to the cart page and checking for a specific pattern until the cart page is empty.
I’ve implemented this like the following:
val chain: ChainBuilder = exec(http("Go To Cart Page")
.get("/cart")
.headers(Config.standardHeader)
.check(bodyString.transform(getRemoveUrl(_)).saveAs("removeUrl")))
.doIf(session => session("removeUrl").as[Option[String]].isDefined) {
exec(http("Removing entry")
.get("${removeUrl}")
.headers(Config.ajaxCall))
.exec(ClearCart.chain) <---- hereNPE happens when running the test
}
When I run the test (actually the remove items is part of a wider test case) the simulation doesn’t even start and I get a NPE.
Any idea of what’s happening? Is this kind of “recursive chain” allowed?