Assert pictures in Robotium.

30 views
Skip to first unread message

hubert.tr...@gmail.com

unread,
Apr 20, 2016, 12:15:07 AM4/20/16
to Robotium Developers
Hello all!
I am new to Robotium and i have a simple app:
1 ImageView
3 RadioButtons to change image in ImageView

I need to test that after click on radioButton, image changes to proper one:

public void testChangeColor() throws Exception{
 
RadioButton radioButton = (RadioButton)solo.getView(R.id.radioButton);
 
ImageView imageView = (ImageView)solo.getView(R.id.imageView);
 
Drawable drawable = ContextCompat.getDrawable(imageView.getContext(),R.mipmap.android_image);

 solo
.scrollToSide(Solo.RIGHT);
 solo
.waitForFragmentById(R.layout.fragment_main);
 solo
.clickOnView(radioButton);
 
Thread.sleep(1000);
 
Assert.assertEquals(imageView.getDrawable(), drawable);

}


Unfortunately this piece of code doesn't work. Any solutions? This should be very basic test though, but i couldn't find any tutorial or piece of knowledge.
Reply all
Reply to author
Forward
0 new messages