Thursday 15 May 2014

android - Robolectric 2.1.1 testing that AsyncTask is started when pressing a button and test it's Results -


I have an activity that presents two fields (user name and password) for user login.

The login button performs an activity in the background (it checks against a remote server).

I am stuck in the test that the login activity is being executed and it is in capturing its results (if the breakthrough changes another activity, if it fails to show the toast notification on the same activity it happens).

This is my code so far:

  @Test public zero testLogIn_Valid () throws an exception {mUsernameEditText.setText (VALID_USER); MPasswordEditText.setText (VALID_PASSWORD); MLoginButton.performClick (); }   

How can I test or duplicate asyncTask's success or failure? And how can I test that the work was actually started?

If you are looking for you have a look at the behavior of Ashynantsky,



No comments:

Post a Comment