-
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
Parameters of nested test suites are overriden #581
Parameters of nested test suites are overriden #581
Comments
I am looking through the testng source and perhaps this is the problem: Class: XmlSuite.java this is in the git repo: /**
* @return The parameters defined in this suite and all its XmlTests.
*/
public Map<String, String> getAllParameters() {
Map<String, String> result = Maps.newHashMap();
for (Map.Entry<String, String> entry : m_parameters.entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
for (XmlTest test : getTests()) {
Map<String, String> tp = test.getLocalParameters();
for (Map.Entry<String, String> entry : tp.entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
}
return result;
} I did not have the time to test it. But perhaps something like this would resolve the problem: /**
* @return The parameters defined in this suite and all its XmlTests.
*/
public Map<String, String> getAllParameters() {
Map<String, String> result = Maps.newHashMap();
for (Map.Entry<String, String> entry : m_parameters.entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
for (XmlTest test : getTests()) {
Map<String, String> tp = test.getLocalParameters();
for (Map.Entry<String, String> entry : tp.entrySet()) {
// check if key already exists and use priority. local test keys are more important
if (result.containsKey(entry.getKey())) {
// assumption for next if statement: this determines that the currently running test is the test we iterate through and test names are distinct.
if (test.getName().equals(getTest())) {
result.put(entry.getKey(), entry.getValue());
}
}
}
}
return result;
} |
Closes testng-team#581 TestNG does not have any logic that would honour parameter tags specified within suite-files tag. But due to a parsing bug, we end up reading parameters that were specified within `<suite-file>` tag. This tag by definition is NOT meant to have any child tags inside of it. Fixed this discrepancy by adding a warning when this anomaly is detected and skipping of reading the `<parameter>` tag inside it as if it were specified within `<suite>` tag.
That has been fixed as part of this PR #2923 |
Closes testng-team#581 TestNG does not have any logic that would honour parameter tags specified within suite-files tag. But due to a parsing bug, we end up reading parameters that were specified within `<suite-file>` tag. This tag by definition is NOT meant to have any child tags inside of it. Fixed this discrepancy by adding a warning when this anomaly is detected and skipping of reading the `<parameter>` tag inside it as if it were specified within `<suite>` tag.
Closes testng-team#581 TestNG does not have any logic that would honour parameter tags specified within suite-files tag. But due to a parsing bug, we end up reading parameters that were specified within `<suite-file>` tag. This tag by definition is NOT meant to have any child tags inside of it. Fixed this discrepancy by adding a warning when this anomaly is detected and skipping of reading the `<parameter>` tag inside it as if it were specified within `<suite>` tag.
Closes testng-team#581 TestNG does not have any logic that would honour parameter tags specified within suite-files tag. But due to a parsing bug, we end up reading parameters that were specified within `<suite-file>` tag. This tag by definition is NOT meant to have any child tags inside of it. Fixed this discrepancy by adding a warning when this anomaly is detected and skipping of reading the `<parameter>` tag inside it as if it were specified within `<suite>` tag.
Closes testng-team#581 TestNG does not have any logic that would honour parameter tags specified within suite-files tag. But due to a parsing bug, we end up reading parameters that were specified within `<suite-file>` tag. This tag by definition is NOT meant to have any child tags inside of it. Fixed this discrepancy by adding a warning when this anomaly is detected and skipping of reading the `<parameter>` tag inside it as if it were specified within `<suite>` tag.
Closes #581 TestNG does not have any logic that would honour parameter tags specified within suite-files tag. But due to a parsing bug, we end up reading parameters that were specified within `<suite-file>` tag. This tag by definition is NOT meant to have any child tags inside of it. Fixed this discrepancy by adding a warning when this anomaly is detected and skipping of reading the `<parameter>` tag inside it as if it were specified within `<suite>` tag.
Also we have tightened the dtd file via testng-team/testng-team.github.io#46 and released a new version of it at http://testng.org/testng-1.1.dtd We have also enriched the codebase to now refer to the tighthened DTD |
Github Demo Project with bug
I wrote a little demo project to show you this problem and that you can play and interact with it. There are also more information on the readme.md.
Check out https://github.com/chillinPanda/testng-parameter-error
Problem
If I nest two test suites into one and use parameter in the nested suite-file definition, those are overriden by following same-name-parameters. In the following example "www.wikipedia.org" will be overriden to "www.google.com" and then the tests at src/test/testng_xmls/testng_wiki.xml get a wrong parameter (the one from below)
The text was updated successfully, but these errors were encountered: