I\'m designing UnitTest for little app. This app cout what numerology number You are using birth date. I have a problem, I what to invoke method which check number and put v
For React Native close performance monitor
getActivity()
implementation is as below:
/**
* @return The activity under test.
*/
public T getActivity() {
if (mActivity == null) {
Log.w(TAG, "Activity wasn't created yet");
}
return mActivity;
}
Since when getActivity()
returns Activity instance, it means, it must create Activity. When Activity gets created, it must create Activity's View. Activity's View can only be created via UI Thread
.
@Before
public void setUp() throws Exception {
mainActivity = intentsTestRule.getActivity(); / *now Activity's view gets created */
/* Because Activity's view creation happens in UI Thread, so all the test cases, here, are used by UI Thread */
}
Now, every test cases are inside the memory of UI Thread. Hence, you should explicitly use @UiThreadTest
for every test.
I solved this problem with adnotation @UiThreadTest before my test method.
put the code where you set value to textview in a new thread;
Handler h=new Handler();
h.post(new Runnable() {
public void run() {
textView.setText(value);
}
});
Looks lile your textview is finInformation use that in run();