Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ant 断言错误而不是失败_Ant_Junit_Junit4_Swtbot - Fatal编程技术网

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

我使用SWTbot和ant开发了一个测试包来构建它,当我运行它时,它发现有一个失败,但是在测试报告中它显示为错误而不是失败: 我的代码是:

    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)