Friday, 28 June 2013

Asserting Toast message using Robolectric | Testing Toast message Android

Hello Friends,
Today , I am sharing my another android tutorial. In this tutorial I am going to show
how to write the test case for android Toast message using Roboelectric and Junit.


 @Test
 public void testToastMesaage() throws Exception{
    Helper.showBadServerNotification(activity);
     assertThat( ShadowToast.getTextOfLatestToast(),equalTo(
              shadowActivity.getString(R.string.bad_server_response)));

 }

Mukesh Yadav

Hi Guys I am from Delhi working as Web/Mobile Application Developer(Android Developer), also have knowledge of Roboelctric and Mockito ,android test driven development... Blogging has been my passion and I think blogging is one of the powerful medium to share knowledge and ideas....

1 comments:

  1. Could you please help me with this problem I have?
    http://stackoverflow.com/questions/31792463/android-error-testing-a-toast

    I haven't find any solution. I'm using mockito.

    ReplyDelete

 

Copyright @ 2013 Android Developer Blog.

Blog Widget by LinkWithin