AssertionError instead of failure

83 views Asked by At

i have developed a test package using SWTbot and ant to build it , when i run it, it finds that there is a failure however in the test report it shows as an error instead of failure: my code is :

    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();

}

and the result is enter image description here

1

There are 1 answers

0
coder11 On

I can see one problem in your code. You are matching Strings with "==" operator. You should use following instead

h[i].equals(targetpack)