# FlakyTest

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Methods](https://developer.android.com/reference/android/test/FlakyTest#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/test/FlakyTest#inhmethods)  

# FlakyTest

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/test/FlakyTest "View this page in Kotlin")\|Java

`
public


abstract
@interface
FlakyTest
`  
`


implements

`[Annotation](https://developer.android.com/reference/java/lang/annotation/Annotation)`


`

|------------------------|
| android.test.FlakyTest |

<br />

*** ** * ** ***

<br />

**This @interface was deprecated in API level 24.**   
Use[FlakyTest](https://developer.android.com/reference/android/support/test/filters/FlakyTest)instead. New tests should be written using the[Android Testing Support Library](https://developer.android.com/tools/testing-support-library).

This annotation can be used on an[InstrumentationTestCase](https://developer.android.com/reference/android/test/InstrumentationTestCase)'s test methods. When the annotation is present, the test method is re-executed if the test fails. The total number of executions is specified by the tolerance and defaults to 1.

## Summary

|                                                                                        ### Public methods                                                                                        ||
|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` int` | ` `[tolerance](https://developer.android.com/reference/android/test/FlakyTest#tolerance())`() ` Indicates how many times a test can run and fail before being reported as a failed test. |

| ### Inherited methods |
|-----------------------|---|
| From interface` `[java.lang.annotation.Annotation](https://developer.android.com/reference/java/lang/annotation/Annotation)` ` |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract `[Class](https://developer.android.com/reference/java/lang/Class)`<? extends `[Annotation](https://developer.android.com/reference/java/lang/annotation/Annotation)`>` | ` `[annotationType](https://developer.android.com/reference/java/lang/annotation/Annotation#annotationType())`() ` Returns the annotation interface of this annotation.                                                                                                                            | | ` abstract boolean`                                                                                                                                                               | ` `[equals](https://developer.android.com/reference/java/lang/annotation/Annotation#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Returns true if the specified object represents an annotation that is logically equivalent to this one. | | ` abstract int`                                                                                                                                                                   | ` `[hashCode](https://developer.android.com/reference/java/lang/annotation/Annotation#hashCode())`() ` Returns the hash code of this annotation.                                                                                                                                                   | | ` abstract `[String](https://developer.android.com/reference/java/lang/String)                                                                                                    | ` `[toString](https://developer.android.com/reference/java/lang/annotation/Annotation#toString())`() ` Returns a string representation of this annotation.                                                                                                                                         | ||

## Public methods

### tolerance

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int tolerance ()
```

Indicates how many times a test can run and fail before being reported as a failed test. If the tolerance factor is less than 1, the test runs only once.

<br />

|                             Returns                              ||
|-------|-----------------------------------------------------------|
| `int` | The total number of allowed run, the default is 1. <br /> |