Hi,
I am writting unit tests on my Android project.
I would like to test whether a specific dialog window appears when i
click on a button.
For example, I have :
----------------------------------Begin Code
---------------------------------------------
public class MyDialog extends Dialog
{
....
}
public class MyActivity extends Activity
{
....
myButton.setOnClickListener( new OnClickListener()
{
@Override
public void onClick(View v)
{
MyDialog window = new MyDialog(...);
window.show();
}
}
.....
}
---------------------------------End
Code-----------------------------------
It works fine, but how to test it?
I start my test method, but i don't know how to finish it :
--------------------------------Begin Code
------------------------------------------------
@MediumTest
public void testMyButtonAction()
{
startActivity(intent,null, null);
Activity currentActivity = getActivity();
myButton = (Button) currentActivity.findViewById(R.id.mybutton);
myButton.performClick();
assertNotNull(........) // what is the method to get Dialog
}
------------------------------- End Code
----------------------------------------------------
Somebody can help me please :D
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---