vladblaj / testng-idea

Automatically exported from code.google.com/p/testng-idea
0 stars 0 forks source link

Plugine doesn't correctly report test failure if data source is used #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Consider the code:

===================
package foo;

import org.testng.annotations.Test;
import org.testng.Assert;

public abstract class AbstractDataSourceTest {
    @Test(dataProvider = "test.data")
    public void test(String data) {
        if (data.equals("fail")) Assert.fail("Faile");
    }
}
===================
package foo;

import org.testng.annotations.DataProvider;

public class DataSourceTest extends AbstractDataSourceTest {
    @DataProvider(name = "test.data")
    public static Object[][] data() {
        return new Object[][]{
                {"foo1"},
                {"foo2"},
                {"foo3"},
                {"fail"},
                {"foo4"},
                {"foo5"},
        };
    }

}
===================

After running this with testng for idea test status is green in tests tree.

Original issue reported on code.google.com by mike.aiz...@gmail.com on 17 Oct 2006 at 8:59

GoogleCodeExporter commented 9 years ago
If the following is used:

    public static Object[][] data() {
        return new Object[][]{
                {"foo1"},
                {"foo2"},
                {"foo3"},
                {"foo4"},
                {"foo5"},
                {"fail"}
        };
    }

Then the test is shown as failed correctly.  The problem is that the test in 
the tree
is reported as failed, then the next data item is passed, and the same tree 
element
is updated.

Someone else mentioned something similar to this but more in regards to
repeating/including test data in the tree.  So you'd see:

Test Results
 `- foo
    `- DataSourceTest
       `- test(foo1)
       `- test(foo2)
       `- test(foo3)
       `- ...

or

Test Results
 `- foo
    `- DataSourceTest
       `- test
          `- (foo1)
          `- (foo2)
          `- (foo3)
          `- ...

The fix for this would be in both TestNG itself and the IDEA plugin, on the 
TestNG
side this would be in the remote string protocol used to communicate between 
TestNG
and the IDE.  I'm not sure what the Eclipse plugin currently does in this 
scenario
(it may be support for this is already in the string protocol).

Which of the two formats do you like better?  Or any other suggestions for the 
UI on
this?

Mark

Original comment by tal...@gmail.com on 27 Oct 2006 at 12:10

GoogleCodeExporter commented 9 years ago
This is now available in the latest build.  Test parameter values are displayed 
in
the tree:  test("foo1").

Original comment by tal...@gmail.com on 10 Nov 2006 at 11:33