import org.custommonkey.xmlunit.* def responseTP=context.expand( '${Intraday Table_TP#Response}' ) def responseLive=context.expand( '${Intraday Table_Live#Response}' ) if (responseTP == responseLive) { log.info "Test case pass" assert true } else{ log.info "Test case failed" def xmlDiff = new Diff(responseTP, responseLive) assert xmlDiff.identical() }
或者简洁一点,直接去比较就好了
import org.custommonkey.xmlunit.* def responseTP=context.expand( '${Intraday Table_TP#Response}' ) def responseLive=context.expand( '${Intraday Table_Live#Response}' ) def xmlDiff = new Diff(responseTP, responseLive) assert xmlDiff.identical()