allure2
allure2 copied to clipboard
Allure is consuming too much memory
When using allure reports with aspecjweaver, the memory consumption is high.
Note that for the following images, I had executed the same set of test cases.
The image below shows the memory usage when i'm using aspectjweaver with allure report, the peak memory usage is almost 2000MB
Below is part of my pom.xml
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> <argLine> -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar" </argLine>> <systemPropertyVariables> <testAutoEnvironment>staging</testAutoEnvironment> </systemPropertyVariables> <suiteXmlFiles> <suiteXmlFile>testsuites/hmsApiRegression.xml</suiteXmlFile> </suiteXmlFiles> </configuration> </plugin>
The image below shows the memory usage when i'm not using aspectj. Note that in my pom.xml, I have removed all aspectj dependencies.
Notice the improvement on the memory usage. The only problem if I go with this is that the "Steps" are not being captured in the report since I removed the aspectj.
Is this high memory usage expected when using allure? Is there a way to capture the "Steps" on the report without using aspectj?
Thank you.
It may consume a lot of memory in case of huge classpath. In that case you need configure AspectJ to only process classes you need (for example, by specifying package name).
And yes, Allure uses aspects only for Step and Attachment annotations. It's optional, and you can use Allure.step methods instead
PS https://www.baeldung.com/aspectj
Thanks @baev. The problem with Allure.step is that the steps are not getting nested in the report when they should be.
Allure.step is that the steps are not getting nested in the report when they should be.
step("first step", () -> {
step("nested 1", () -> {
// do smth
});
step("nested 1", () -> {
// do smth
});
});
`public void firstStep(){ Allure.step("First Step"); firstNestedStep(); secondNestedStep(); }
public void firstNestedStep(){ Allure.step("First Nested Step"); }
public void secondNestedStep(){ Allure.step("Second Nested Step"); }`
Thank you for the example. I was expecting that the above code will give me a nested steps in the report like the one below would.
`@Step public void firstStep(){ firstNestedStep(); secondNestedStep() }
@Step public void firstNestedStep(){}
@Step public void secondNestedStep(){}`