-
Notifications
You must be signed in to change notification settings - Fork 20
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
Test/Step name only uses method name instead of test name #147
Comments
@gtque There was an essential reason to change it. Unfortunately I'm currently on vacation without a laptop to prepare a detailed answer. But nothing prevent you to implement your own "get test step name" method to move forward. This is a part of our official API and won't be changed. |
@HardNorth I'm not entirely sure I understand what you are suggesting. I would be very interested in the reason. I understand moving it to the method, but I am interested in why the behavior was altered. |
@HardNorth ok, but how will just overriding that method work? ReportPortalTestNGListener always uses your implementation of TestNGService.java. Also why was the behavior changed? |
@HardNorth Any updates for a more detailed answer about why the behavior was changed? This change breaks thousands of our tests! |
@gtque @brian30040, Ok I implemented a special test for that case and reverted implementation on a previous one for a moment. Here what I got: Well, what I see here is that parent test and both step names are the same. And how that behavior helps to solve the issue you mentioned here (about parameterized tests)? Actually you can distinguish one test from another if you go inside a step and open "Item Details" section. In the section you will find parameter list and their values. Actually it was literally a long-standing bug which ended in to a situation when people start messing tests and test steps. And it was fixed in version 5. Because the view on the screenshot above is a step level view (with method types). And test level is a level above. Test steps and their test should have different names because they are different entities on different levels. Moreover we need to keep naming logic similar for similar frameworks, so current behavior conforms with behavior of JUnit 4 and JUnit 5 agents. Again, you are free to customize your naming convention by overriding I think the discussion is over here. |
@HardNorth Going into "item details" is also not helpful as we pass a collection of objects, making the identification of that particular run difficult. Which is why we use the TestNG test name to inject a more detailed name into the "test" name. Whether you call it a step or test is simply a matter of terminology depending on the framework you are using. In either case, we run the same method (whether you call it a test or a step is irrelevant) and modify the test name. When reviewing the JUNIT report produced, the test/step name is as we expect. It is only in report portal where it is not correct. This is the TestNG agent, not the JUNIT4 or JUNIT 5 agent. As such it seems you should be supporting TestNG. And no, I don't think the discussion is over. |
@HardNorth |
@HardNorth |
@gtque I would not recommend you keep posting duplicate issues, because in that case I'll just block you for the organization. As I said So my bet here is to keep it as is. Anyway it's open source, you are free to implement your own agent.
|
@HardNorth The problem with having to implement my own agent is that it creates a point of potential future conflict. As you mentioned in your license, you are free to implement any changes you all see fit and I use it "as is". In order to support your suggestion, I not only have to implement a The bug is that you have a specific TestNG agent that no longer supports the test/step name provided from testng and instead just use the method name. |
@gtque There is one simple rule for discussions, called "burden of proof". That means a statement maker is also responsible for providing proofs of the statement. So please provide proofs of your words, for example, a test project. |
@HardNorth There is a custom service and listener implemented. If the test class is in the From what I have found, you can just use Here is the junit xml output. Notice the testnames, if overridden either with the test annotation or the getTestName method, appear as expected in the xml report, but not in report portal. |
The fix will be not earlier that in 6th version of RP and agents, since it breaks retry and re-run logic. |
When will this be fixed it has been almost 3 years from this and I am having the same issue report is coming with test method name instead of test name given? |
@alkachawda Please don't spam any issue you can find with irrelevant comments. TestNG has nothing to do with pytest and vice versa. I already deleted one from you and I'm going to delete this one too. If you post another one I'll just block you for the whole project. |
Commit 102b03e87020f7855198770104a99bab350fca1f
refactored the step name into a new method:
protected String createStepName(ITestResult testResult) { return testResult.getMethod().getMethodName(); }
But did not preserve the original logic of checking for test name. This completely breaks the naming between versions for anyone using/setting the testng test name and is preventing us from updating to the latest version.
Here is the original if statement in the
buildStartStepRq
method:if (testResult.getTestName() != null) { testStepName = testResult.getTestName(); } else { testStepName = testResult.getMethod().getMethodName(); }
The text was updated successfully, but these errors were encountered: