Automation testing | How crucial is that for mobile app development?

The word automation says a lot about reducing human effort. Thus automation testing in software industry surely helps QAs with-

  • Regression test suite
  • Smoke / Sanity test suite
  • Build deployment
  • Test data creation
  • Automating behind the GUI like testing of APIs and methods

Now in this era of automation testing (AT), it’s important to identify whether the project is appropriate for automation testing or not. Automation testing does not overpower or replaces manual testing but it does is compliments the manual testing. Automation testing needs a strategy with proper planning, monitoring & control similar to manual testing. Automation testing thus when implemented correctly, can become an asset to the team, project and ultimately to the organization.

So, there are significant advantages of automation testing. Like-

  • Very useful to execute the routine tasks like smoke tests and regression tests.
  • Beneficial in preparing the test data.
  • Helps to execute the test cases which involve complex business logic.
  • Great to execute the test cases which are a bit difficult to execute manually.
  • Great to execute the cross-platform test cases (like different OS, browsers etc.)
  • When the number of iterations of the test case executions is not known automation testing is the best fit.

Let me put a demonstration for you how automation testing is done. Our QA Mr. Md. Mohoiminule Islam Chowdhury Sohol has put his work on automation testing together to help the community. Here’s his work on automation testing.

Automation Testing By Sohol

13 Steps by steps instruction to configure Appium and Android in Windows:

• Download Android SDK from the following location:
http://www.develoepr.android.com/sdk/index.html
• Run .exe file of Android Studio.
Find the SDK Location at c: / Users / user / AppData / Local / android / SDK
• Download Java from the following location:
http://www.oracle.com/technetwork/java/javase/downloads/jdk9-downloads-3848520.html
• Set System variables path for both Java and Android so that your System detect these locations.

• Download Eclipse from the following location:
https://eclipse.org/downloads/
• Extract Eclipse folder and open the eclipse.exe file to launch editor.
• Install ADT Plugin into eclipse following instructions from below link:
https://stuff.mit.edu/afs/sipb/project/android/docs/sdk/installing/installing-adt.html
• Complete these settings in Eclipse once you configured ADT Plugin to make it recognize:
a. set the path of SDK Location in Preference window”.

b. “Open Custom Perspective and make Android AVD Manage Enable.

• Create Android Virtual Device which will be later used for Testing:

• Download Dotnet Framework 4.5 to support Appium Latest version from the below link:
https://www.microsoft.com/en-us/download/confirmation.aspx?id=30653
• Install Appium Server from the below link:
https://github.com/appium/appium-desktop/releases/tag/v1.2.7 (Select .exe based on your OS)
• Download Appium and Selenium Jars from Maven Repositories.
mvnrepository.com/artifact/io.appium/java-client/2.1.0

• Create a Basic Java Project in Eclipse by configuring all these jars into it.[

Check the devices is connected with PC:

D:\SQA Files\selenium\adt-bundle-windows-x86_64-20140702\sdk\platform-tools

Command: >adb devices

Mobile device configure:

Settings->Developer options–>ON
Settings–>Developer options–>USB debugging enable
Settings–>Developer options–>USB configuration–>MIDI
Appium run:
Open appium
Set Host= 127.0.0.1
Port= 4723 & click ‘Advanced’
Check ‘Allow session override’
Start appium

Run Mobile Application in Real Android Device:
package mobile1;
import java.io.File;
import java.io.IOException;
import java.net.URL;

import org.openqa.selenium.By;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.remote.MobilePlatform;

import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

@SuppressWarnings(“unused”)
public class mobile1 {

@SuppressWarnings(“rawtypes”)
public AndroidDriver driver;

@SuppressWarnings(“rawtypes”)
@Test(priority=0)
public void config() throws InterruptedException, IOException {

try {
//Android
//File app = new File(“D:\\GG Projects\\Connect\\builds\\Android\\app-debug-v.1.2.c-October 2, 2016.apk”);

//iOS
File app = new File(“D:\\com.bs.ecommerce.nopstation_2.0.2.apk”);
//File appDir = new File(“src”);
//File app = new File(appDir, “app-debug-v.1.2.c-Sep 28, 2016.apk”);

DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
cap.setCapability(MobileCapabilityType.DEVICE_NAME, “Galaxy S8+”);

cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
cap.setCapability(MobileCapabilityType.NO_RESET, “true”);
driver = new AndroidDriver(new URL(“http://127.0.0.1:4723/wd/hub”),cap);

// System.out.println(driver);

Thread.sleep(25000);

System.out.println(“click inside the mobile application”);

try {

driver.findElement(By.xpath(“//android.widget.ImageView[@content-desc=’More options’]”)).click();
Thread.sleep(10000);
System.out.println(“click Done”);

driver.findElement(By.id(“com.bs.ecommerce.nopstation:id/title”)).click();
Thread.sleep(10000);
System.out.println(“click Done”);

driver.findElement(By.id(“com.bs.ecommerce.nopstation:id/emailEditText”)).sendKeys(“[email protected]”);
Thread.sleep(5000);
System.out.println(“Input User Name”);

driver.findElement(By.id(“com.bs.ecommerce.nopstation:id/passwordEditText”)).sendKeys(“123456”);
Thread.sleep(5000);
System.out.println(“Input User Password”);

driver.findElement(By.id(“com.bs.ecommerce.nopstation:id/loginButton”)).click();
Thread.sleep(10000);
System.out.println(“click LogIn”);

driver.findElement(By.id(“com.bs.ecommerce.nopstation:id/tv_productName”)).click();
Thread.sleep(10000);
System.out.println(“click Products”);

driver.findElement(By.id(“com.bs.ecommerce.nopstation:id/btn_addtoCart”)).click();
Thread.sleep(10000);
System.out.println(“click Add to cart”);

driver.findElement(By.id(“com.bs.ecommerce.nopstation:id/menu_cart”)).click();
Thread.sleep(10000);
System.out.println(“click shopping cart”);

driver.findElement(By.id(“com.bs.ecommerce.nopstation:id/checkoutBtn”)).click();
Thread.sleep(10000);
System.out.println(“click Proceed to checkout”);

driver.findElement(By.id(“com.bs.ecommerce.nopstation:id/btn_continue”)).click();
Thread.sleep(10000);
System.out.println(“click Continue”);

driver.findElement(By.id(“com.bs.ecommerce.nopstation:id/btn_continue”)).click();
Thread.sleep(10000);
System.out.println(“click Continue”);

driver.findElement(By.className(“android.widget.CompoundButton”)).click();
Thread.sleep(10000);
System.out.println(“click Ground button”);

driver.findElement(By.id(“com.bs.ecommerce.nopstation:id/btn_continue”)).click();
Thread.sleep(10000);
System.out.println(“click Continue”);

driver.findElement(By.xpath(“//android.widget.CompoundButton[@index=’1′]”)).click();
Thread.sleep(10000);
System.out.println(“click Cash On Delivery (COD)”);

driver.findElement(By.id(“com.bs.ecommerce.nopstation:id/btn_continue”)).click();
Thread.sleep(10000);
System.out.println(“click on Continue”);

driver.findElement(By.id(“com.bs.ecommerce.nopstation:id/btn_continue”)).click();
Thread.sleep(10000);
System.out.println(“click on CONFIRM”);

}catch (Exception e) {
e.printStackTrace();
// TODO: handle exception
}

}catch(NullPointerException nullException) {
System.out.println(“Exception Caught !”);
}

}

}

“Automation Testing Demo: Mobile App”

Leave a Comment

Your email address will not be published. Required fields are marked *