Skip to content
This repository has been archived by the owner on Jan 14, 2019. It is now read-only.

Tests showing as twice #731

Closed
fropcorn-ravi opened this issue Jan 11, 2016 · 11 comments
Closed

Tests showing as twice #731

fropcorn-ravi opened this issue Jan 11, 2016 · 11 comments

Comments

@fropcorn-ravi
Copy link

untitled

Hello i have an issue for getting the reports where i am using giving parameters in testng.xml to run the same test class twice for different devices. everything is going fine but in the report all the test cases are showing twice for each device.
my testng.xml file is as follows

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="testExecution" parallel="methods" thread-count="2">
  <test name="SamsungS4">
      <parameter name="device" value="Samsung5.1.1"></parameter>
      <parameter name="deviceName" value="a01b27a8"></parameter>
      <parameter name="version" value="5.1.1"></parameter>
    <classes>
      <class name="testsuite.testExecution"/>
    </classes>
  </test> <!-- Test -->
  <test name="Nexus">
      <parameter name="device" value="Nexus6.0.1"></parameter>
      <parameter name="deviceName" value="03829155439cb1e8"></parameter>
      <parameter name="version" value="6.0.1"></parameter>
    <classes>
      <class name="testsuite.testExecution"/>
    </classes>
  </test> <!-- Test -->
</suite> <!-- TestConfig -->
@volkovs
Copy link
Contributor

volkovs commented Jan 11, 2016

Hello. IMO it is expected behavior. Report shows as many test cases as many executions there were. It doesn't matter whether the test was parametrized or not. So, if test passed on one device and failed on another one, there will be two test cases with according statuses. For test name you can't use placeholders (as for test steps https://github.com/allure-framework/allure-core/wiki/Steps#placeholders ). But test name should be extended with parameters values automatically.

@fropcorn-ravi
Copy link
Author

Thank you for your reply , I will tell the whole scenario . I am using Appium with help of selenium grid and I am giving device parameters in testng.xml the screenshot I attached is only one test case running in both the devices. But it's showing same test cases many number of times.

@volkovs
Copy link
Contributor

volkovs commented Jan 11, 2016

@fropcorn-ravi could you please provide testng.xml once more?

Usually duplicated test cases mean duplicated executions (e.g. several Allure adapters in class path, not cleaned project from previous execution, etc.). You can have a look how many tests Allure knows about right after execution (but before report generation). Please look through target/allure-results/*-testsuite.xml files.

@fropcorn-ravi
Copy link
Author

untitled

@baev baev added the question label Jan 12, 2016
@fropcorn-ravi
Copy link
Author

i have checked the xml generated by allure report. test cases were showing twice for each device, i have attached the pom xml in the attachement , could you please check and tell where i have done a mistake.
pom.txt
and please find the test allure report generated xml to txt files for both devices
device (1).txt
device (3).txt

@modnarlp
Copy link

Hello.

I have the same situation as @fropcorn-ravi. In my pom.xml i defined suiteXmlFile in which i defined java class with method marked with @factory annotation. Every time i invoke
mvn clean test
from command line it show me that 3 tests were performed but in report(mvn site) i see twice as much.

FactoryClass.txt
runner.txt
pom.txt

@yulia-nechaeva
Copy link

Hey guys, look at these lines in your pom.xml:

<!--only for 1.3.* TestNG adapters. Since 1.4.0.RC4, the listener adds via ServiceLoader-->
<properties>
    <property>
            <name>listener</name>
            <value>ru.yandex.qatools.allure.testng.AllureTestListener</value>
    </property>
</properties>

Since you are using TestNG version 1.4.* you don't need these properties in the pom anymore. Looks like listener adds twice in that case and that's why tests are showing twice in report.

So, report shows correctly after deleting that piece of code from pom.xml.

@modnarlp
Copy link

Hello, thanks a lot for your answer. You are absolutely right with that additional AllureTestListener in pom.xml cause the problem.

@baev baev closed this as completed Jan 22, 2016
@fropcorn-ravi
Copy link
Author

Thanks a lot , you were right....

Ravi Kiran
Software Development Engineer in Test
Fropcorn

On 22-Jan-2016, at 12:35 AM, Yulia notifications@github.com wrote:

Hey guys, look at these lines in your pom.xml:

listener ru.yandex.qatools.allure.testng.AllureTestListener Since you are using TestNG version 1.4.\* you don't need these properties in the pom anymore. Looks like listener adds twice in that case and that's why tests are showing twice in report.

So, report shows correctly after deleting that piece of code from pom.xml.


Reply to this email directly or view it on GitHub.

@fdPoornima
Copy link

Hi @fropcorn-ravi : How were you able to insert the details of the devices in the report i.e: Nexus, version etc. Also, for me the second device execution is shown as a retry, is this working fine for you

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants