allure-java icon indicating copy to clipboard operation
allure-java copied to clipboard

Disable StepAspects possible?

Open pandoras-toolbox opened this issue 3 years ago • 4 comments

How can I disable io.qameta.allure.aspects.StepAspects? I would like to replace it with my own implementation because I want to abbreviate too large parameter values automatically.

pandoras-toolbox avatar Feb 23 '22 14:02 pandoras-toolbox

you can create a custom annotation instead of default one, or you can try to exclude io.qameta.allure.aspects package from weaving (by using aop.xml)

baev avatar Feb 24 '22 11:02 baev

I figured it out:

<aspectj>
    <!--    <weaver options="-warn:none -Xlint:ignore"/>-->
    <weaver options="-verbose"/>
    <aspects>
        <aspect name="com.foobar.CustomStepsAspects"/>
        <exclude within="io.qameta.allure.aspects.StepsAspects"/>
    </aspects>
</aspectj>

But I have a problem with the JUnit test. Only the first test passes, the other tests fail because of:

AllureLifecycle - Could not start step: no test case running

The aspect and the test classes are exact copies in my project. If I do not activate my copy of the aspect and do not exclude the original aspect then my copy of the test runs.

pandoras-toolbox avatar Feb 25 '22 09:02 pandoras-toolbox

It is because I have also a custom aspect implementation for AllureAssertJ in the same Gradle subproject called "common". I do not want to put each aspect into a separate subproject. Is it possible to have these two aspects in the same Gradle subproject and that their tests do not interfere with each other?

pandoras-toolbox avatar Feb 25 '22 14:02 pandoras-toolbox

I don't know, but in the end it did not work to make these tests running, I spent hours with finding the reason.

I think I will try to create an aspect for the toString() methods instead of these parameter object types which can be too long, in order to abbreviate them so that they are also abbreviated in the Allure report.

However I still believe it would make sense to have the option to limit the maximum string length of these parameter values for the Allure report. These values can be very long with big JSON requests and responses, and if there are many tests, it could blow up the Allure report.

pandoras-toolbox avatar Feb 28 '22 09:02 pandoras-toolbox