Define, Share and Automate your tests / specifications

Json comparaison

Tmar allows defining values as Json for Json message comparaison.
To define a column as a collection of Json values you have to call the method setJsonComparison('<column name>',<sort list>) in a method with @Before annotation
 
The <sort list> parameter tells Tmar if list values have to be in the same order or not.
 
 
 
@Before
def setupTest() {
setJsonComparison('json',true)
...
}
Example

Expected value

returned value

setJsonComparison('jsonExpanded',true)
As days List is not ordered the same way in both message, and <sort list> is set to true, Tmar raise an error
setJsonComparison('jsonExpanded',false)
With <sort list> set to false, Tmar considers both messages equivalent

 Jspresso Tmar © 2013 - 2015