allure2 icon indicating copy to clipboard operation
allure2 copied to clipboard

Allure is consuming too much memory

Open Agent1997 opened this issue 3 years ago • 4 comments

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 image

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. image

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.

Agent1997 avatar Feb 22 '22 15:02 Agent1997

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

baev avatar Feb 22 '22 16:02 baev

Thanks @baev. The problem with Allure.step is that the steps are not getting nested in the report when they should be.

Agent1997 avatar Feb 25 '22 09:02 Agent1997

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
  });
});

baev avatar Feb 25 '22 10:02 baev

`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(){}`

Agent1997 avatar Feb 25 '22 11:02 Agent1997