Define, Share and Automate your tests / specifications

Override value tranformation

By default, Tmar tries to parse String, Integer, Double and Boolean types.
 
To override this behavior you can use the method setTransformValue() in the method with @Before annotation for JUnit or @BeforeClass  for TestNG
 
For table, or a table column, you are able to set a closure that overrides the default transformation. ‘sequence’ and ‘each’ are valid table name in order to transform iterations values.
 
@Before
def setupTest() {
def myShareContext = loadSharedContext(
... // use myShareContext
 
    setTransformValue('sequence','birthdate'){ value ->
       SimpleDateFormat formatter = new SimpleFormat(“dd/MM/yyyy”)
       return formatter.parse(value) 
}
}

 

In this example values in the column 'birthdate' is now considered as Date