-
Notifications
You must be signed in to change notification settings - Fork 223
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
Dynamically setting @TmsLink, @DisplayName & @Issue with DataProvider data #156
Comments
I am able to achieve this by implementing Issue and overriding the value() at runtime, is there a simpler more readable/friendly means of doing so? if not this is something I feel has real benefit in adding |
we can implement Issue/DisplayName/TmsLink in our own class, then using the java reflection API check for the test method at runtime and override the values for these annotations but we must set them as blank on the test method, my solution works but its very hacky and really unclean, is there a better way guys? @UseDataProvider("saveCourseData")
@DisplayName("")
@Issue("")
@TmsLink("") Method m = SaveCourse.class.getDeclaredMethod("savecourse_scenarios_return_appropriate_responses", SeverityLevel.class,
String.class, String.class, String.class
, int.class, String.class, String.class, int.class, int.class, boolean.class, boolean.class, int.class,
String.class); Issue i = m.getAnnotation(Issue.class);
DynamicIssue di = new DynamicIssue(issueId);
AnnotationHelper.changeAnnotationValue(i, "value", di.value()); |
Any update on this? I'd also like to see that feature. In my current project I sometimes have up to 20 parametrized tests served by one test method and it's difficult to keep track of all |
Did you tried Also you can use and |
@baev that will do the trick. Thanks a lot! |
@Juvat, can you please share the code snippet you implemented using Allure.getLifecycle() API? |
I am using following code to dynamicly change DisplayName at run time: |
I'm struggling to get it work but it's not working for me. I am using this approach: https://www.swtestacademy.com/change-test-name-testng-dataprovider/ Instead of the Extent report part I'm using this to updated the allure report test case name but it's not working with the latest Allure version 2.20.1:
I see the method name change while executing in IntelliJ, in the console output, the instance name is changed in the testng-results.xml but does not change the Displayed Name in the Allure report (I still see the default method name) and get these errors:
Any ideas @baev, @Juvat, @GregoryGum ? What am I doing wrong? |
I'm submitting a ...
template.
What is the current behavior?
I cannot seem to figure out a way in order to set the Issue, TmsLink and display name programmatically from the @test method, I have tried overriding the value(s) at runtime but with no success, my report does not seem to include the data
What is the motivation / use case for changing the behavior?
When using the junit @dataProvider annotation and passing data from a 2D array, we can then set our Issue/TmsLink/DisplayNames in the array test data and the report would reflect such data.
My sincerest apologies if this is possible to do already, I am struggling to find a way to make it work effectively
Other information
When annotating the method with the @issue("foo"), all tests of the data provider will be set with this IssueId
Note: Sorry i logged this issue in the wrong project, please close close the issue here:
allure-framework/allure2#645
The text was updated successfully, but these errors were encountered: