1

当我运行我的 TestNG 测试时,我得到以下针对失败测试的截断输出:

Failed tests: retrievedDataFromService(com.mydomain.ServiceTest): The returned data is not correct:(..)

Assert.fail() 中的实际字符串是这样的:

StringBuilder msg = new StringBuilder("The returned data is not correct:");
msg.append("\n expected = ");
msg.append("<xml>some data</xml>");
msg.append("\n was = ");
msg.append("<xml>some other data</xml>");

如果我从消息中删除换行符,则会显示所有内容:

Failed tests: retrievedDataFromService(com.mydomain.ServiceTest): The returned data is not correct: expected = <xml>some data</xml> was = <xml>some other data</xml>

有没有办法让 TestNG 在“失败的测试”输出中显示换行符?

4

0 回答 0