-
Notifications
You must be signed in to change notification settings - Fork 226
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
🐞: TestNg throws an error when trying to run dependent tests with withAllureUpload(){} #1017
Comments
To disable the Allure tests filter, you must unset the following environment variables: Also, we can support dependent tests in TestNG: The filtering is done in https://github.com/allure-framework/allure-java/blob/main/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNgTestFilter.java class. We need to analyse all the test methods and include all the methods that selected tests depend on in the run. That should do the trick. Although, what should we do with groups? If some selected test depends on the group, should we include all the tests in such a group? |
I tried using 'unset ALLURE_TESTPLAN_PATH and AS_TESTPLAN_PATH before tests run'. As far as I know, an environment variable cannot be completely unset. I tried like:
and different variations with unset, but the result the same. Here is an example of the console log:
It would be great if you could implement "We need to analyze all the test methods and include all the methods that the selected tests depend on in the run." About groups, we use them very rarely, but I agree that if a test is related to a group, then the entire group should be run - otherwise, the test result will be incorrect/failed |
What happened?
TestNg throws an error when trying to run dependent tests with withAllureUpload(){}
I know that dependent tests violate idempotency and atomicity of tests, but we have a product with complex logic and sometimes it is necessary to make tests dependent, so we use the TestNg framework, which has parameters like dependsOnMethods or dependsOnGroups.
We have integrated with Allure TestOps, but we also want to use the ability of selective test execution. After studying the TestOps documentation, we tried to dynamically generate testng.xml based on testplan.json, which is created by TestOps during selective test execution, so that all tests in the class where the necessary test is located are launched.
The generator gets the full method names from testplan.json, cuts off the method name, and writes the full class name. According to our idea, the results should be updated for both dependent and independent tests in class.
An example of the generated testng.xml file:
But when we run such a testng.xml file, we still get an error:
Method "SomeClassTest.someTest1()[pri:0]" depends on nonexistent method "someTest2"
Some mechanism, possibly filtering, breaks the launch of tests in the order we need.We would like to generate testng.xml ourselves based on testplan.json and have it run smoothly and publish results in TestOps. Maybe it can be disabled or do you have a solution for selective execution of dependent tests for TestNg?
What Allure Integration are you using?
allure-testng
What version of Allure Integration you are using?
2.20.0
What version of Allure Report you are using?
2.20.0
Code of Conduct
The text was updated successfully, but these errors were encountered: