-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Same xmlsuite is added multiple times when tests are run using TestNG.SetXmlSuites method #863
Comments
Could you share the content of |
TestNG1 - >
TestNG2 ->
|
Hi juherr, I am on testng 6.9.4. I would have tried the latest version but saw that this part of the code hasn't changed. |
@juherr, Does it look like a bug? |
Yes, it looks like. Would you like to try to fix it? |
Let me take a look at it and will validate my understanding of the issue with the community. Is there any documentation which talks about running TestNG unit tests on local machine? |
Just run testng.xml suite in IDE, or use the build tool you prefer between gradle, maven or kobalt. |
Alright, let me put this up and I will send a PR for it. |
It seems that this issue(behavior) was modified as a part of #829 |
In fact, I think #829 is just hiding the issue as it allows to have duplicate name. Now, I think you have another issue: some suites are run twice. |
Yes suites are now run twice. Let me send a PR and lets discuss the impact of the fix with some code. |
@cbeust @juherr in the context of this issue, the core problem is that in #829 we introduced a check to allow multiple suites with same name. I think it will be explicit that a suite with same name will be actually pointing to the same set of test. If this is the case we will have test sanity check that will not allow same test names in a run
in testng.java Am i correct with my understanding? if this is the case then the change in#829 might not have the desired functionality. I will send a PR with my assumption and lets see how it goes. |
I think the solution should not be to check what is duplication or what is not, but find why TestNG is adding the same suite many times and fix it. |
Please check my solution for making your TestNG suites more DRY https://stackoverflow.com/a/51666801/4165898 |
@cbeust,
Here is the description of the problem.
My trimmed down run engine code
My suite XML looks like this
you can have any two testNG suites as mentioned here.
Problem
When you run this code you will get an exception stating
Two suites cannot have the same name: Suite2
This exception will come even if you have two different suite names. The reason is because of this code in initializeSuitesAndJarFile of TestNG class
here do we really need adding of same suite back to the parent? s.getChildSuites().add(cSuite);
Virender
The text was updated successfully, but these errors were encountered: