Full Table

To query all data from a table use: def PRICES = db.table("PRICES") PRICES.should == ["ID" | "DESCRIPTION" | "PRICE"] { ___________________________________ "id1" | "nice set" | 1000 "id2" | "another set" | 2000 }

Custom Query

def queriedData = db.query("select * from PRICES where id=:id", [id: "id1"]) queriedData.should == ["ID" | "DESCRIPTION" | "PRICE"] { ___________________________________ "id1" | "nice set" | 1000 }

Single Value

def price = db.query("select price from PRICES where id=:id", [id: 'id1']) price.should == 1000 price.shouldNot == 2000

Query Result Value

Value returned from query methods is an instance of DatabaseQueryResult type. It keeps the context of where the value came from and preserves it during assertions to have additional information in a test report.To access underlying value for business logic use def price = db.query("select price from PRICES where id=:id", [id: 'id1']) if (price.singleValue > 100) { println("do something") }