tanyehzheng
tanyehzheng

Reputation: 2221

Testng marked a test as success when it should fail

I have test code as below. test1 passes the test but test2 failed when I expect both to fail. Can anyone please explain why this happens?

@Test(dataProvider="prov")
public void test1(int x, int y){
    System.out.println("x=" + x + ", y=" + y);
    assertEquals(x + y, 3);
}

@Test(dataProvider="prov")
public void test2(int x, int y){
    System.out.println("x=" + x + ", y=" + y);
    assertEquals(x + y, 7);
}

@DataProvider
public Object[][] prov(){
    return new Object[][]{
        {1,2},
        {3,4}
    };
}

Upvotes: 1

Views: 463

Answers (1)

tanyehzheng
tanyehzheng

Reputation: 2221

Bingo! This is a netbeans bug. In command line, both tests failed.

Off to report the bug now...

Upvotes: 1

Related Questions