We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More
This site is now read-only. You can still browse and search as usual. Learn More
You can use the following code:
...
if (!(it.value == outputResp[it.key]))
{
log.info ("File Mismatch at : " + it.key)
testRunner.fail( "File mismatch..." )
}
...1.Yes. Is that possible?
2. True!
i found some Code and it works but maybe u can help me. If there is a Mismatch there is only a log.info and the test continues with "PASS". Is taht possible to say is there a mismatch the test failed?
import groovy.json.JsonSlurper
def filePath = "C:/qwerty/test.json"
def jsonResp = context.expand('${GET ProCon#Response}')
def outputResp = new JsonSlurper().parseText(jsonResp)
def baselineResp = new JsonSlurper().parseText(new File(filePath).text)
baselineResp.each{
if (!(it.value == outputResp[it.key]))
{
log.info ("File Mismatch at : " + it.key)
}
}You can use a keyword assert i.e assert expected == actual