Created
July 7, 2021 13:57
-
-
Save heitorpaceli/208c8c7c0410fc23d5373aa8179d6f35 to your computer and use it in GitHub Desktop.
Order of UI Automator methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.paceli.wifitest | |
import android.util.Log | |
import androidx.test.ext.junit.runners.AndroidJUnit4 | |
import org.junit.* | |
import org.junit.runner.RunWith | |
@RunWith(AndroidJUnit4::class) | |
class UiAutomatorOrder { | |
/** | |
* Run before the method with @Test annotation | |
*/ | |
@Before | |
fun before() { | |
Log.d(TAG, "Before") | |
} | |
/** | |
* Run after the method with @Before annotation | |
* and before methods with @After annotation | |
*/ | |
@Test | |
fun test() { | |
Log.d(TAG, "Test") | |
} | |
/** | |
* Run after each method with @Test annotation | |
*/ | |
@After | |
fun after() { | |
Log.d(TAG, "After") | |
} | |
companion object { | |
private const val TAG = "UiAutomatorExample" | |
/** | |
* Run once before other methods from [UiAutomatorOrder] class | |
*/ | |
@JvmStatic | |
@BeforeClass | |
fun beforeClass() { | |
Log.d(TAG, "Before Class") | |
} | |
/** | |
* Run once after other methods from [UiAutomatorOrder] class | |
*/ | |
@JvmStatic | |
@AfterClass | |
fun afterClass() { | |
Log.d(TAG, "After Class") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment