CheckBox control:
Click CheckBox1 to check it Click CheckBox again to uncheck it
Steps:
1. Click the CheckBox 1 checkbox
Validation: Return prompt: Check Box 1 is selected
2. Click the Check Box1 checkbox again (to uncheck the effect)
Validation: Back Prompt: Check Box 1 unchecked
- publicvoid testUI() throws Exception {
- this.CheckBox();
- }
- publicvoid CheckBox(){
- boolean expected = true;
- solo.clickOnButton("CheckBox");
- solo.clickOnCheckBox(0);
- boolean actual = solo.searchText( "Check Box 1 is selected" );
- assertEquals("This is not found",expected,actual);
- solo.clickOnCheckBox(0);
- boolean actual2 = solo.searchText( "Check Box 1 unchecked" );
- assertEquals("This is not found",expected,actual2);
- solo.goBack();
- }
Here solo.clickOnCheckBox(0) represents the first CheckBox element: Check Box 1
And so on, 1 represents the second CheckBox element: Check Box 2
CheckBox implementation: http://luwenjie.blog.51cto.com/925779/915848
This article is from the " Xiao Maozi " blog, please be sure to keep this source http://xiaomaozi.blog.51cto.com/925779/917073