rerunner-jupiter icon indicating copy to clipboard operation
rerunner-jupiter copied to clipboard

How can we repeat all the tests when they failed by only one declaration in BaseTest Class?

Open swtestacademy opened this issue 6 years ago • 5 comments

Rather than adding "@RepeatedIfExceptionsTest(repeats = 3)" for each test, how can we add a one declaration for all tests?

swtestacademy avatar Oct 24 '18 05:10 swtestacademy

I wanted to do something like that and I came quite far with it but then I read this: https://github.com/artsok/rerunner-jupiter/issues/28#issuecomment-491564260.

That would probably be a problem.

I got it to work when I set List<Boolean> historyExceptionAppear in RepeatIfExceptionsExtension to Collections.synchronizedList(new ArrayList<>()). But that used to be in the code and was removed in this commit: https://github.com/artsok/rerunner-jupiter/commit/9416adc227c625c38a2e0c0036c44de1310e6ba6 To fix https://github.com/artsok/rerunner-jupiter/issues/11

616slayer616 avatar Jul 01 '19 11:07 616slayer616

Hi @616slayer616

It is greate, that you want to do it! I have'nt free time to invistigate it :(

I inited this value at line 87.

изображение

Is it matter for you to init it as class value, as you want?

Can you show work example of this feature?

artsok avatar Jul 01 '19 19:07 artsok

Maybe you can try this. It seems to work but I'm not sure , maybe it only works on my machine https://github.com/616slayer616/rerunner-jupiter/tree/annotaion_on_class

616slayer616 avatar Jul 02 '19 06:07 616slayer616

@616slayer616 There seems to be good work in this PR; perhaps though the new test you added should have the @RepeatedIfExceptionsTest removed from the methods to verify with certainty that only the class-level annotation is working.

sethcall avatar Jul 12 '19 12:07 sethcall

You are rigtht I forgot to remove the method level annotations.

This is not going to work this way.

The RepeatedIfExceptionsTest is supposed to replace the Test annotation https://github.com/artsok/rerunner-jupiter/issues/28#issuecomment-491564260

We would have to introduce a new annotation to achieve this (https://github.com/artsok/rerunner-jupiter/pull/44#issuecomment-507774583)

616slayer616 avatar Jul 12 '19 13:07 616slayer616