Use change matcher and takeSnapshot to assert that a value is change/not-changed or wait for the change: Groovy value.should change . [value] changed (0ms) Check matchers/import-and-dependencies Import And Dependencies for prerequisites. Java actual(value).should(change); . [value] changed (0ms) Check matchers/import-and-dependencies Import And Dependencies for prerequisites. Groovy value.waitTo change > waiting for [value] to change . [value] changed (101ms) Java actual(value).waitTo(change); > waiting for [value] to change . [value] changed (101ms) Note: Value must implement SnapshotValueAware interface to work with change matcher. Common WebTau abstractions like web page element and file content already implement them. Use code matcher below as an alternative if you can't have interface implemented.
Use code matchers to validate that a block of code changes a value: Groovy code { updateDbEntity(dbEntity) } should change("dbEntity.id", dbEntity::getId) > expecting code to change value of dbEntity.id X failed expecting code to change value of dbEntity.id: actual: "id1" <java.lang.String> expected: not "id1" <java.lang.String> (0ms) Java code(() -> { updateDbEntity(dbEntity); }).should(change("dbEntity.id", dbEntity::getId)); > expecting code to change value of dbEntity.id X failed expecting code to change value of dbEntity.id: actual: "id1" <java.lang.String> expected: not "id1" <java.lang.String> (0ms) Pass a java bean to to validate that at least one property is changed Groovy code { buggyOperation(dbEntity) } should change("dbEntity", dbEntity) > expecting code to change value of dbEntity X failed expecting code to change value of dbEntity: dbEntity.description: actual: "description1" <java.lang.String> expected: not "description1" <java.lang.String> dbEntity.id: actual: "id1" <java.lang.String> expected: not "id1" <java.lang.String> dbEntity.value: actual: 100 <java.lang.Integer> expected: not 100 <java.lang.Integer> (1ms) Java code(() -> { buggyOperation(dbEntity); }).should(change("dbEntity", dbEntity)); > expecting code to change value of dbEntity X failed expecting code to change value of dbEntity: dbEntity.description: actual: "description1" <java.lang.String> expected: not "description1" <java.lang.String> dbEntity.id: actual: "id1" <java.lang.String> expected: not "id1" <java.lang.String> dbEntity.value: actual: 100 <java.lang.Integer> expected: not 100 <java.lang.Integer> (1ms) Use shouldNot to enforce that a value doesn't change Groovy code { calculatePrice(dbEntity) } shouldNot change("dbEntity", dbEntity) > expecting code to not change value of dbEntity X failed expecting code to not change value of dbEntity: dbEntity.description: actual: "description-changed" <java.lang.String> expected: "description1" <java.lang.String> ^ dbEntity.value: actual: 110 <java.lang.Integer> expected: 100 <java.lang.Integer> (0ms) Java code(() -> { calculatePrice(dbEntity); }).shouldNot(change("dbEntity", dbEntity)); > expecting code to not change value of dbEntity X failed expecting code to not change value of dbEntity: dbEntity.description: actual: "description-changed" <java.lang.String> expected: "description1" <java.lang.String> ^ dbEntity.value: actual: 110 <java.lang.Integer> expected: 100 <java.lang.Integer> (0ms)