For some reason, we need sometimes to skip test cases (due to found known bugs, temp environment issues, etc.), but still, have them in our statistics.
And moreover, somehow get informed if the bug is fixed or the condition changed and the test case is ready to get back into our regression scope.
How to do this - implement smart @skip annotation
So what do we expect from annotation?
By setting it near our test case, the case will be executed. But in the Allure report, it will be marked as 'Skipped' (gray label).
If the test case will pass without fail, it will be marked as 'Unknown' (purple label) - that will be the trigger for us in Report, that case status changed.
Below is an example, of how to implement this in Java code:
@After("@skip")publicvoidskipScenario(Scenario scenario) {log.info("Test case is skipped.");if(Allure.getLifecycle().getCurrentTestCase().isPresent()) {String testCaseNameWithUuid = Allure.getLifecycle().getCurrentTestCase().get();Pattern pattern = Pattern.compile("([a-f0-9]{8}(-[a-f0-9]{4}){4}[a-f0-9]{8})");Matcher matcher = pattern.matcher(testCaseNameWithUuid);String uuid ="";while(matcher.find()) {uuid = matcher.group(1);}if(scenario.isFailed()) {Allure.getLifecycle().updateTestCase(uuid, testResult -> {testResult.setDescription("Test has skip reason (ex. open bug or env problem)").setStatus(io.qameta.allure.model.Status.SKIPPED);});}else{Allure.getLifecycle().updateTestCase(uuid, testResult -> {testResult.setDescription("Skip reason solved (ex. open bug is fixed)");testResult.setStatus(null);});}}else{log.info("Test case run locally.");}}

