Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to use @Flaky annotation(How to use @Flaky annotation for running failing tests more than once.)
How to use @Flaky annotation [message #1743424] Thu, 15 September 2016 10:23 Go to next message
Vivek Veera is currently offline Vivek VeeraFriend
Messages: 18
Registered: July 2015
Junior Member
Team,

I have some tests which fail sometimes unexpectedly and run fine when executed next time. So, to handle these tests I am trying to use @Flaky annotation (org.eclipse.xtext.junit4.Flaky). Here is my usage:

@Rule
public Flaky.Rule testRule = new Flaky.Rule();

@Flaky
@Test
public void testMethod() {
Assert.assertTrue(false);
}


As per documentation, the failing tests should get executed 3 time by default. But, I do not see the test running 3 times. It runs once and fails. Thats all. Nothing happens after that.

Am I missing any other configuration for using @Flaky annotation. I would like to know if any of you have used this annotation or have knowledge on how to use it for failing tests. Appreciate your time.

Thanks.
Vivek Veera
Re: How to use @Flaky annotation [message #1743427 is a reply to message #1743424] Thu, 15 September 2016 11:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13884
Registered: July 2009
Senior Member
id have expected something like

@Rule
public Flaky.Rule testRule = new Flaky.Rule();


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to use @Flaky annotation [message #1743432 is a reply to message #1743427] Thu, 15 September 2016 12:23 Go to previous messageGo to next message
Vivek Veera is currently offline Vivek VeeraFriend
Messages: 18
Registered: July 2015
Junior Member
Hi Christian,

I could not understand your point. Could you please elaborate.
Are you suggesting to include a rule. I have actually added that if you see my code snippet below.

@Rule
public Flaky.Rule testRule = new Flaky.Rule();

@Flaky
@Test
public void testMethod() {
Assert.assertTrue(false);
}



Thanks for replying.
Vivek Veera
Re: How to use @Flaky annotation [message #1743433 is a reply to message #1743432] Thu, 15 September 2016 12:30 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13884
Registered: July 2009
Senior Member
the following works nice for me

import org.eclipse.xtext.junit4.Flaky;
import org.eclipse.xtext.xbase.lib.InputOutput;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;

@SuppressWarnings("all")
public class DemoTest {
@Rule
public Flaky.Rule testRule = new Flaky.Rule();

@Flaky
@Test
public void testMethod() {
InputOutput.<String>println("mimi");
Assert.assertTrue(false);
}
}


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:xtext keyword problem
Next Topic:Integrating Xbase in my DSL. How to activate scoping and validation?
Goto Forum:
  


Current Time: Fri Apr 16 23:42:30 GMT 2021

Powered by FUDForum. Page generated in 0.02147 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top