Skip to content
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

Repeat on failure #53 #214

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Repeat on failure #53 #214

wants to merge 1 commit into from

Conversation

oomelianchuk
Copy link
Contributor

No description provided.

Copy link

@wurzelkuchen wurzelkuchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have some points where we could improve. Some of which needs further investigations.

{
TYPE, METHOD
})
public @interface RepeatOnFailure

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need JavaDoc here.

@@ -0,0 +1,24 @@
package com.xceptance.neodymium.module.statement.repeat;

public class RepeatOnFailureData

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need some JavaDoc here.


import com.xceptance.neodymium.module.StatementBuilder;

public class RepeatStatement extends StatementBuilder

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also JavaDoc

public static AtomicInteger val = new AtomicInteger(0);

@Test
public void testVisitingHomepage()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to have some more meaningful test case names here.

import com.xceptance.neodymium.module.statement.repeat.RepeatOnFailure;

@RunWith(NeodymiumRunner.class)
public class OverridingRepeatOnFailureTest

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is not testing any override.

}
catch (Throwable t)
{
if (iterationIndex != maxRepetitionNumber)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we interact with a browser, we will need a fresh browser instance here. Otherwise we will reuse the same browser with cookies and session data from the previously failed test.

})
public @interface RepeatOnFailure
{
int value() default 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value currently represents the number of maximum runs. So if we have it set to 1, we'll run only once even if the test fails. The semantic of @RepeatOnFailure(1) is that the test is repeated once on fail therefore has two runs.
We should change the meaning of the value so that @RepeatOnFailure(1) has one repeated run (or in other words two runs).

public String getTestName(Object data)
{
RepeatOnFailureData d = (RepeatOnFailureData) data;
return "Run number " + d.getIterationNumber();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Run number X" is not super obvious as a retried test case run to see in a report. Maybe we could do something more eyecatching.
Maybe keep the original run with the original name, and add an uppercase "RETRY X" or something to it.
image

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should investigate if we can improve the current implementation in terms of reporting.
In the jUnit/Allure report, we a lot of skipped runs if the run succeeded before the maximum was reached. Also we always see all failed (repeated) runs, will be go as errors into any report statistic. It would be cool if we could configure to suppress such failed cases which went green on retry (since the test case is known to be flaky otherwise we would not add this annotation).

image
image

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please investigate if removing the "skipped" and "failed" runs from the reporting can be done easily, otherwise we can add an improvement in a separate task.

}

@Override
public String getCategoryName(Object data)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This leads to a separate category in the junit test report for all tests using this annotation. It would be nicer if only test reruns land in a separate category and tests which ran successfully just go into a default category.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants