allure-framework / allure1

Allure 1 isn't supported any more, please consider using Allure 2 https://github.com/allure-framework/allure2 instead
Apache License 2.0
712 stars 169 forks source link

Report does not show TestNg test names and method names correctly #814

Closed irushah closed 8 years ago

irushah commented 8 years ago

Hi,

I added Allure reports to my existing TestNg framework. I run the tests using Maven from test suite files which have defined which classes and tests to run. For some reason, the generated report shows test names as "Unknown test case" and for some Parameterized test cases it shows the dataset parameters as the test name.

Is it expected behaviour? How do i make it show proper test names.

Here's snippet of test suite: testng.xml

<suite name="SMOKE-TEST-SUITE" verbose="1">
    <test name="SMOKE-TESTS" parallel="false" preserve-order="true">
        <groups>
            <run>
                <include name="Group1" />
                <include name="Group2" />
            </run>
            <dependencies>
                <group depends-on="Group1" name="Group2" />
            </dependencies>
        </groups>
        <classes>
            <class name="TestCase1" />
            <class name="TestCase2" />
        </classes>
    </test>
</suite>

Test case example:

@Test(groups = Group2)
@Features("Feature1")
@TestCaseId("4413")
public class TestCase1 extends Setup {
    @Test(dataProvider = "dataset1")
    public void testCaseMethod(@Parameter("param1") String param1, @Parameter("param2") String param2) {
         doSomething(param1, param2);
    }
       @DataProvider(name = "dataset1")
    private Object[][] getDataset1() {
        return new Object[][] {
                { "param1data1", "param2data1"},
                { "param1data2", "param2data2"}
           };
    }
irushah commented 8 years ago

@baev Anything you see i'm missing?

baev commented 8 years ago

@irushah sorry I don't know much about TestNg, it is supported mostly by the community.

sskorol commented 8 years ago

@irushah can you show screenshots?

irushah commented 8 years ago

Here's screenshot of above described code where i expect to see TestCase1 instead of "UnknownTestCase" and testCaseMethod instead of "Unknown test case"

image

volkovs commented 8 years ago

@irushah could you please describe how Test ID 4413 got included in report (there is no such ID in your code)?

irushah commented 8 years ago

Ohh, ignore that, i missed to add in my example code above. I dont think its related to that. But, i have corrected the example code with TestCaseId annotation above after @Test

@TestCaseId("4413")

volkovs commented 8 years ago

@irushah Allure takes test case meta data from annotations on method level, not on type level.

Also if you annotate type as @Test it will execute all public methods as tests not taking into account method annotations. That is why IMO it is a mistake to annotate both type and method.

irushah commented 8 years ago

Ohh.. I got it. I removed @Test(groups = Group2) from the type and added the group to method. And that fixed it. Thanks alot @volkovs. Closing the bug.