I am trying to run the test case which I created, but after creating the test case when I switch to Tester mode and dragged the test case to "TestRunner" panel, I found that the Execute button is disabled.
I am not sure what else I need to configure or it's a bug.
Here is my script:
package AndroidAutomationTest.AutomationTest;
import java.io.File;
import junit.framework.Assert;
import android.os.Build;
import android.os.RemoteException;
import android.util.Log;
import com.android.uiautomator.core.;
import com.android.uiautomator.testrunner.;
import static AndroidAutomationTest.BBAT_Utility.BBATUtility.*;
/**
SampleTest
NOTE:1.This class can contain only one test case.
2.Do not change the class name.
*/
public class SampleTest extends UiAutomatorTestCase {
private static String TAG = "SampleTest";
/**
@throws RemoteException
* @generated
All your test code will go here
NOTE: Do not change the method signature
*/
public void test() throws UiObjectNotFoundException, RemoteException {
System.out.println("testcase execution started");
takeScreenShot();
//CODE:START
getUiDevice().wakeUp();
getUiDevice().pressHome();
UiObject apps = new UiObject(new UiSelector().description("Apps"));
apps.click();
UiScrollable appViews = new UiScrollable(new UiSelector().scrollable(true));
// Set the swiping mode to horizontal (the default is vertical)
appViews.setAsHorizontalList();
UiObject appObject;
appObject = appViews.getChildByText(new UiSelector().className(android.widget.TextView.class.getName()), "Settings");
appObject.click();
UiObject wifi = new UiObject(new UiSelector().text("Wi-Fi"));
wifi.clickAndWaitForNewWindow();
appViews.setAsVerticalList();
appObject = appViews.getChildByText(new UiSelector().className(android.widget.TextView.class.getName()), "Add Wi-Fi network");
if(appObject.isEnabled())
{
System.out.print("Wi-Fi not disabled.");
Assert.fail();
}
else
{
System.out.print("Wi-Fi disabled.");
}
//CODE:END
System.out.println("testcase execution completed");
}
}
Please let me know if you need more information from my side.
Hi
This is because the test device is not added.
You have to also drag and drop the device in to the testdevices view. This will enable the execute button.
http://uiautomator-bot.blogspot.com
Hi
This is because the test device is not added.
You have to also drag and drop the device in to the testdevices view. This will enable the execute button.
http://uiautomator-bot.blogspot.com
Thanks Syed, now I am able to run the tests.
I would really appreciate if you can help me to attach debugger into the source code i.e. if I want to step through every line of code in order to debug any issues?
Is it possible using the tool?
No debugging of test scripts is not possible with UIautomator-bot.