Ant 断言错误而不是失败
我使用SWTbot和ant开发了一个测试包来构建它,当我运行它时,它发现有一个失败,但是在测试报告中它显示为错误而不是失败: 我的代码是:Ant 断言错误而不是失败,ant,junit,junit4,swtbot,Ant,Junit,Junit4,Swtbot,我使用SWTbot和ant开发了一个测试包来构建它,当我运行它时,它发现有一个失败,但是在测试报告中它显示为错误而不是失败: 我的代码是: public static void Check_TargetPack(final SWTWorkbenchBot bot,String configuration, String targetpack) { boolean exist=false; String[] h=bot.comboBoxWit
public static void Check_TargetPack(final SWTWorkbenchBot bot,String configuration,
String targetpack) {
boolean exist=false;
String[] h=bot.comboBoxWithLabel("TargetPack").items();
int i=0;
for (i=0;i<h.length;i++){
if (h[i]==targetpack)exist=true;
assertTrue("target pack"+targetpack+" doesn't exist in targetpack list",exist);
};
bot.sleep(2000);
bot.button("Close").click();
}
public static void Check\u TargetPack(最终SWTWorkbenchBot机器人,字符串配置,
字符串(目标包){
布尔存在=假;
字符串[]h=bot.comboBoxWithLabel(“TargetPack”).items();
int i=0;
对于(i=0;i我可以在代码中看到一个问题。
您正在使用“==”运算符匹配字符串。
您应该使用以下选项
h[i].equals(targetpack)