[android-developers] Re: JUnit test case blocking main UI thread for AsyncTask

2011-04-21 Thread Jason
Thanks Billy! I'll give it a go - Jason On Apr 19, 1:28 pm, Billy bbrack...@gmail.com wrote: Jason, here is the solution I am using, and it seems to work well. You are basically still doing the testing on thetestthread, but when it comes time to call theasynctaskwe switch to theuithread, and

[android-developers] Re: JUnit test case blocking main UI thread for AsyncTask

2011-04-20 Thread Billy
Jason, here is the solution I am using, and it seems to work well. You are basically still doing the testing on the test thread, but when it comes time to call the asynctask we switch to the ui thread, and block the testing thread. When the UI thread is done, it releases the testing thread and you

[android-developers] Re: JUnit test case blocking main UI thread for AsyncTask

2011-04-05 Thread Jason
Hi, Missed your response. This didn't work for me unfortunately. Interestingly if I mark the test with @UiThreadTest I get the same deadlock behavior, which makes me wonder whether there is some sort of JUnit test state being re-used when the test is run in a suite? As it stands I have a bunch

[android-developers] Re: JUnit test case blocking main UI thread for AsyncTask

2011-04-05 Thread Jason
OK.. So after re-thinking this I realized why the problem is occurring, although I still do not have a solution. When the test is running it seems to be treating itself as the main UI thread, which would make sense since it's an ActivityInstrumentationTestCase2. The AsyncTask performs the

[android-developers] Re: JUnit test case blocking main UI thread for AsyncTask

2011-03-17 Thread Streets Of Boston
JUnit test-methods in the instrumentation test-case classes always run in another thread than the main UI thread. I run both indiviual test-cases and test-suites (that execute lists of test-cases) and test-methods are always called in a different thread than the background thread. I read this