New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 706225 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
not available
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Behavior change for @UiThreadTest in JUnit4

Project Member Reported by yolandyan@chromium.org, Mar 29 2017

Issue description

In JUnit4 android testing support library, @UiThreadTest cause the test method, @Before and @After to all run on UiThread.

This can cause quite a bit of issues because a lot of setUp actions require to be done on Instrumentation worker thread, so the viable work-around became running a lot of tests in UiThreadTestRule.runOnUiThread()
block. It can get ugly

To resolve this, we can either move the @Before/@After component that needs to run on instrumentation thread into its own separate rule. Which can escape from @UiThreadTest's control.

Another idea is we can support our own annotation or only test methods on UiThread w/o affecting @Before and @After, but this can get confusing on which annotation to use and would diverge from android's default behavior

I will look into this once JUnit4 migration is over
 
Status: Assigned (was: Untriaged)

Sign in to add a comment