Automation with SeeTest Cloud

image2016-3-15 12_13_22

     From my experience with automation execution on Cloud tools, I had done the executions with Perfecto Cloud, Sauce Labs, Browserstack; now am with SeeTest Cloud. In SeeTest Cloud, easily run your Selenium and Appium tests against real iOS, Android & desktop browsers, ensuring that you are testing real user scenarios accurately.

       Start testing mobile and web applications on the cloud. It will support both manual and automation tests. Allows you to easily create automated tests for your mobile application using our large selection of real iOS and Android.

     Here I would like to share what are the capabilities required to execute your automation scripts in SeeTest Cloud for Mobile Native (iOS and Android), Mobile Web (iOS and Android) and Desktop Browsers. Before start setup the capabilities and script execution, you need a account in SeeTest Cloud. For the account, you need to register with SeeTest Cloud (https://cloud.seetest.io/) and get the access key, specify the access key in the set of test capabilities to gain access to remote testing. Once the access key ready, you can set the Desired Capabilities and instantiate the driver for Automation scripts. Following steps helps to get the access key from your registered SeeTest Cloud account,

In the cloud, click on your profile → Get Access Key

Capture.PNG

For Mobile Native - Android

AndroidDriver driver = null;
DesiredCapabilities dc = new DesiredCapabilities(); 
dc.setCapability("testName", "Android Mobile Native Test Execution"); 
dc.setCapability("accessKey", "your_SeeTest_acess_key");
dc.setCapability("deviceQuery", "@os='android'"); 
dc.setCapability("deviceModel", "device_name"); 
dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, "device OS_version"); 
dc.setCapability(MobileCapabilityType.UDID, "device_UDID"); 
dc.setCapability(MobileCapabilityType.APP, "application_location_in_SeeTest"); 
dc.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "application_package_name"); 
dc.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "application_activity_name"); 
driver = new AndroidDriver<>(new URL("https://cloud.seetest.io/wd/hub"), dc);
For Mobile Native - iOS

IOSDriver driver = null;
DesiredCapabilities dc = new DesiredCapabilities(); 
dc.setCapability("testName", "iOS Mobile Native Test Execution");
dc.setCapability("accessKey", "your_SeeTest_acess_key");
dc.setCapability("deviceQuery", "@os='ios'"); 
dc.setCapability("deviceModel", "device_name"); 
dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, "device_OS_version"); 
dc.setCapability(MobileCapabilityType.UDID, "device_UDID"); 
dc.setCapability(MobileCapabilityType.APP, "application_location_in_SeeTest Cloud"); 
dc.setCapability(IOSMobileCapabilityType.BUNDLE_ID, "Bundle_ID of the application");
driver = new IOSDriver<>(new URL("https://cloud.seetest.io/wd/hub"), dc);
For Mobile Web - Android

AndroidDriver driver = null;
DesiredCapabilities dc = new DesiredCapabilities(); 
dc.setCapability("testName", "Android Mobile Web Test Execution");
dc.setCapability("accessKey", "your_SeeTest_acess_key");
dc.setCapability("deviceQuery", "@os='android'"); 
dc.setCapability("deviceModel", "device_name"); 
dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, "device_OS_version"); 
dc.setCapability(MobileCapabilityType.UDID, "device_UDID"); 
dc.setBrowserName(MobileBrowserType.CHROMIUM);
driver = new AndroidDriver<>(new URL("https://cloud.seetest.io/wd/hub"), dc);
For Mobile Web- iOS

IOSDriver driver = null;
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability("testName", "iOS Mobile Web Test Execution");
dc.setCapability("accessKey", "your_SeeTest_acess_key");
dc.setCapability("deviceQuery", "@os='ios'");
dc.setCapability("deviceModel", "device_name");
dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, "selected_device_OS_version");
dc.setCapability(MobileCapabilityType.UDID, "device_UDID");
dc.setBrowserName(MobileBrowserType.SAFARI);
driver = new IOSDriver<>(new URL("https://cloud.seetest.io/wd/hub"), dc);
For Desktop Web

WebDriver driver;
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability("testName", "Desktop Web Test Execution");
dc.setCapability("accessKey", "your_SeeTest_acess_key");
dc.setCapability(CapabilityType.PLATFORM, "desktop_OS_name"); 
dc.setCapability(CapabilityType.BROWSER_NAME, "name of the browser"); 
dc.setCapability(CapabilityType.VERSION, "browser_version");
driver = new RemoteWebDriver(new URL("https://cloud.seetest.io/wd/hub"), dc);

Now, the capabilities and driver is ready, next you can start writing your automation scripts and execute it on SeeTest Cloud.

make it perfect !

 

Cloud Testing with Selenium – Sauce Labs

Introduction to cloud testing

     Basically we can execute the automation test scripts in the VMs, which are not in our control. Example, if we want to execute the script on Firefox version 24.0 which is not available for us. So the infrastructures which are the company provided for us are limited; client asks to execute the scripts in different browser configuration and different OS configuration. Cloud testing is on-demand one. In the tight schedule of test execution we can’t buy all the infrastructures. So for that the concept came up is the cloud based testing. In the case of Level 3 companies; most of the cases they go to test in cloud. Through this we can run our script local into those servers in the cloud.

     Here I would like to introduce a cloud testing concept called Sauce Lab. Sauce Lab is the cloud testing component. This is basically designed for automation testing as well as manual testing. We can execute the test cases in Sauce cloud. Following are the important concepts related to automation testing in sauce lab cloud:

Sauce Lab account creation

     The Sauce Lab infrastructure is paid one. We can also create the free accounts for 14-days. Your 14 days won’t begin until you run your first test. It is providing 8 concurrent VMs, 90 Hours of automation testing and unlimited manual testing. No credit card needed to create a free account. Needed following information to create a free account in Sauce Lab: First Name, Last Name, Email, Company name, Company Size, Username and Password.

     Once you done the registration it will take you to “Run your first test now!” window with following options:

1. Automated – Run your automation Selenium test or JavaScript unit tests.

2. Mobile – Automatically test your hybrid and native iOS and Android apps.

3. Manual – Test your site in any browser instantly, like IE 7 or mobile safari.

     We can select any of the above options based on your requirements of testing. If we move to dashboard in the Sauce Lab; we can see the jobs and its details (is it running/completed).

Test script execution in cloud

     Before moving to scripting, I would like to share something about Desired Capabilities class. This class is basically use when you are running the test cases on a server or somewhere VMs outside of local PC scope or when we use the cloud computing as well as run the appium test cases. We will provide our entire requirement to Desired Capabilities class. Example: I need to run on Mac machine or run on Windows. Also I need to run on Firefox xx version. These as the desired capability and need to pass these requirements to this class. When we start the automation the object first read and understands that what are the capabilities the host is expecting to run the test cases.  What OS it wants to run and what browser it is expecting? Then it will go and connect to the Sauce Lab and it checks all the VMs and where ever the requirement is satisfied. In Sauce Lab there are 100 VMs are available. Once we send these requirements with help of Desired Capabilities class to cloud and the response will come from cloud, then after our test script will execute in the cloud.

     To run the test script on the cloud we needs the test script in local; make sure that we have added all the mandatory annotations in the script (say @BeforeTest, @Test and @AfterTest). Another important aspect is Desired Capabilities; based on the test execution requirement we can add the capabilities and send them to the server for execution. I have mentioned the following are desired capabilities that I added for my test execution requirement:

cloud testing

     Apart from normal selenium script, the major change will happen in the section of WebDriver initialization. In URL, there are two parameters: one is where we want to run the test cases and second, what are capabilities need to send to the server through the specified URL. The syntax of first parameter is below:

     http://saucelabid:Accesskey@ondemand.saucelabs.com:80/wd/hub

     Once we set all ready and next step is to run the script as normal way. When the script starts run just go back to your Sauce Lab dashboard, there you can see the job sessions and same time you see test execution environment, results of test execution, run time etc., Tap on “View Fullscreen” link, we will get the complete test execution status. It includes Screencast section that explains the current test execution as live video; we can track the selenium logs, Commands, metadata. Below are the screens of Sauce Lab dashboard and test execution full view:

1

Figure 1: Dashboard view with jobs in beta version

2

Figure 2: Dashboard view with jobs in non-beta version

3

Figure 3: Command view

4

Figure 4: Screencast view

5

Figure 5: Selenium Logs

6

Figure 6: Metadata view