Showing posts with label QA. Show all posts
Showing posts with label QA. Show all posts

Monday, April 2, 2018

The impact of detecting a bug late in the delivery cycle

The impact of detecting a bug late in the delivery cycle can be best illustrated with this short joke:

Once upon a time, in a jungle there lived a strong and cruel lion. He would hunt and kill animals at random to satisfy his own sadistic pleasure rather than his hunger. All the forest animals lived in perpetual fear of the lion. This cruel and reckless killing went on and on until one day, when the Lion was sleeping all the other animals mustered courage and gathered for a meeting.

“This simply cannot go on!”, the wise old Elephant trumpeted. “We cannot continually live in fear of of the lion. We have to find a solution.”

All the animals in the gathering nodded in assent.

“The Elephant speaks the truth.”, the Giraffe said. “Let’s get our heads together!”

“Let’s set a trap for the Lion in the forest and kill him”, the monkey said.

“Let’s seal off the entrance to his cave. He’ll remain trapped inside and die of hunger and thirst.”, the deer suggested.

The Elephant shook his head. “All that you have suggested has been tried before. The Brute is too strong to be trapped inside. He will simply dig his way out and continue his evil deeds. He is also too cunning and shrewd and can smell any trap.”, he replied sadly.

“What do you suggest then?”, the Wild Buffalo asked.

The Elephant replied, “I have thought about it long and hard. There is only one way. It’s not an easy solution, but it will guarantee that all in the forest will live in peace at least.”

With bated breath the animals waited for the pachyderm to announce his solution.

“I propose that we request the lion to kill one chosen animal each day instead of him killing all of us randomly and indiscriminately. That way only one animal has to die and the rest of us can continue living in peace. We can draw lots and choose the animal from amongst us.”, the Elephant said.

With no better solution in sight, the other animals agreed to his plan. Trembling with fear, they went to the Lion’s cave to put forth their request.

The Lion, fresh after a good sleep was surprised to see the entire forest gather in front of him when he stepped outside.

“Aha!”, he roared. “Today my food has found me, saving me the trouble to search.”

The Elephant mustered courage and addressed the Lion thus, “O Mighty King of Beasts! In the past few years, none of us have been able to escape your cruelty. We live in constant fear of being hunted by you. Our lives and daily routines are in shambles. We cannot continue living like this. Therefore, for the good of the jungle and all those who live in it, we have a proposition for you. Please hear us out. We beg you agree to it.”

The Lion stifled a yawn and said, “Ok, go ahead!”

The Elephant outlined his proposition while all the other animals listened on eagerly.

Finally, when the Elephant was done explaining his solution, the Lion thought for a while.

Then, after what seemed like an eternity for the other animals he said, “I agree!”

The announcement brought loud cheer from the gathered crowd.

The Lion waited for the cheers to subside and then said, “But, I have one condition.”

Silence fell across the crowd, each animal wondering what condition the Lion wanted, worried whether they would be able to fulfill it or not.

“Name it!”, the Elephant said.

The Lion said, “I will tell you a joke. My condition is that all the animals HAVE to laugh. If I see anyone not laughing, the agreement becomes null and void and I will resume my old ways.”

Relieved, all the animals nodded in assent. The Lion started his joke. It was a PJ and probably one of the lousiest jokes they had ever heard. But when he was done, all the animals broke out into hilarious laughter. Even the crocodiles suppressed their tears and were rolling on the ground laughing their head off.

The Lion surveyed the crowd to check if any animal was not laughing, but could find none. But just as he was about to turn away, in the corner he noticed a tortoise peering outside it’s shell. The tortoise looked around grim and serious, probably wondering what the commotion was all about.    

“Aha! I see one animal not laughing to my joke.”, he said pointing to the tortoise. “The agreement is now null and void. I shall resume my old ways again”, the Lion roared.

The animals angrily glared at the tortoise which innocently went inside its’ shell, totally oblivious to the situation.

Once again, the Lion resumed it’s old cruel ways. But the next day, the animals gathered outside the Lion’s cave again and one more put forth their proposition. The Lion agreed but with the same condition as before. This second joke was even more stale and lousy than the first one, but all the animals put up a brave front and laughed their head off. All, except the tortoise which once again grimly stared outside his shell, a dead serious expression on his face. Once again, the Lion noticed the Tortoise and pointed it out with devilish glee. All the animals looked daggers at the amphibian which, oblivious to the hostility directed at it slunk back inside its’ shell.

And yet again, the lion resumed it’s cruel ways. But after a few days, the animals gathered again outside the Lions’ den to make the same request. This time they did not tell the tortoise as they feared it would spoil the show again. But the tortoise got wind of the plan and followed them at a distance.

But this time, the Lion had a different condition.

“I will tell you a story. All of you will have to CRY at this one. This is your last and final chance. If you screw up I will get back to my old ways and this time, no one will stop me!”, the Lion roared.

Terrified, the animals waited till the Lion completed his story. When he was done, they started bawling shamelessly. The Hyena came out of his comfort zone and really cried his heart out. Loud sounds of tears and crying could be heard from all sides. The Lion did a careful survey to check for any defaulters. And to his surprise, this time he saw the tortoise rolling over in his shell, LAUGHING away to glory.

Enraged, he roared, “THIS IS AN INSULT! THE DEAL’S OFF!” pointing towards the amphibian.

Dismayed, the animals looked at the direction the Lion was motioning and noticed the tortoise laughing.

Once again, oblivious to the situation around him, the tortoise innocently said between laughs, “That first PJ was hilarious!”  

--------------------------------------------------------

Here are some lessons from this joke:


Hope you enjoyed the joke and more so, the meaning I tried to convey through it. Detecting a major bug very late in the delivery cycle can cost a lot to fix in terms of effort, quality and not to mention frayed tempers and overall project health. So as a good tester, it's of paramount importance to prioritize your tests and make sure the critical scenarios are covered first to reduce risks.

Happy testing !!

Cheers,

Srinivas Addanki







 

Thursday, September 28, 2017

The current state of Software QA in the Indian IT industry



An ex-military man applied for the post of Software QA Engineer in a reputed Indian IT firm. Being technically competent, he easily cleared all the technical and HR rounds. While the offer letter was being prepared, the HR executive and the candidate were having a conversation.

The exec noticed that the candidate had ticked the physical disability check-box.But on the surface, the candidate appeared physically fit, with no sign of any injury whatsoever.

Curious to know, the HR asked the ex-military guy, “Er.. Sir, I’ve noticed that you’ve ticked the physical disability checkbox in the form. May I ask about the nature of your disability?”

With a deep sigh, the Military man responded, “If you must know, my testicles were blown off by a landmine in a military operation.”

“Ouch.”, the HR executive responded.
“Now that you know, I would appreciate if you keep this fact private. I would also like to make it clear that I do not wish to be shown any preferential treatment or discrimination owing to my disability.", the Military man stated clearly.

The exec assured him that he would keep the fact private and that there would be no preferential treatment or discrimination shown to him in any form whatsoever.

After the papers were signed, the exec warmly shook hands with the candidate and said, “Welcome to the company. You can join the coming Monday. Your daily reporting time is 11 AM.”

The Military guy responded, “Thanks a lot. By the way, I noticed that your company working hours are from 9 AM. Why should I report at 11? Am I being placed in a shift?”

The HR replied, “Err…. No. That’s keeping you ‘unique disability’ in mind.”

The Military guy flared up; anger bristling in his voice. “Did I not just tell you that I don’t want to be shown any preferential treatment for my disability?”

The exec replied in a calm and soothing tone, “I am extremely sorry to have offended you sir. I did not mean to show you any preferential treatment. Allow me to explain. Our company QA team reports at 9 AM each day. But since the build arrives at 11 AM, for two hours our team does nothing except scratch their balls. Since this does not apply to you, you might as well report at 11 AM.”

And that, ladies and gentlemen is the current state of Software testing in the Indian IT industry.
  

Friday, February 5, 2016

The death of the Testing specialist



In many QA Job opportunities and postings these days, I have observed that almost 90% of the job descriptions specify coding and automation knowledge as mandatory. This does seem natural, going by the logic that IT and software companies do require a certain amount of computing cognizance. But as a hard-core QA professional who’s spent more than 12 years trying to break code, it really doesn’t make sense.

And why you ask? Surely a good tester should know how to code? I beg to differ. While I agree that knowledge of coding is definitely an advantage for a tester; a feather in one’s cap, it is no substitute for hard-core testing and QA skills. It takes a fair bit of creativity, instinct and effort to find critical bugs in software. In today’s highly complex software scenario, testing has evolved into a highly specialized and viable career option rather than an offshoot of development and coding which many sadly perceive it to be even today. It is a mistake to ask your tester for coding skills. If the testers start to code, then what will the coders do?

In the good old days of yore, software project teams were split into specialized teams based on their job functions: BA teams for requirement gathering and liaising with the client, A technical architect for designing the software architecture, DBA teams for setting up and maintaining the Database,  Development teams for coding and unit testing, a QA team for preparing Test cases, RTM and testing the application and an Application Maintenance team for providing support after product Go-live. Each team had a manager for guidance. Each team had their defined boundaries and everyone had a clear cut task and skill. The work was well-defined and everyone was happy.

But the scenario is changing fast. Software is growing in complexity day by day. The landscape has become very competitive, especially for IT service providing companies based in India who look to add value to their clients by delivering high quality software in a reasonably quick time. Newer and more dynamic methods of Software delivery such as Agile have replaced traditional software models. In a bid to maximize revenue, many companies actually take testing very lightly and look to reduce the head count of the testing team. In many teams, the developer to Tester ratio is highly skewed in favour of the dev team. Many project and delivery managers sadly have a very biased opinion about testing. “Testing?!! Mehhh ….. anybody can do that!” they say. Very little priority and thought is given to testing these days and this is the prime cause of software failures. When software fails, the credibility of the organization and the team which built the software takes a hit and this results in numerous other complications.

Which is why you need specialized testing teams for detecting bugs before deploying the application and going live or before UAT. The art and science of detecting defects in code is a very specialized skill which requires a lot of patience, perseverance, skill, creativity, instinct and experience. No amount of coding experience can substitute it.

Let’s take a simple example. Lets’ say you’re a newly appointed chef in a reputed hotel and you have just rolled out a new signature dish. You will of course, taste a bit of it to check if all the ingredients have the right consistency. Too much sugar or too little salt, a dash of chilly and pepper to boost the taste. If you’re satisfied, you can send the dish out to the customer. But you would be taking a great risk in doing so. A wise and experienced cook will always have the maturity to let a specialist taster and sampler to sample the dish before sending it out. Let’s face it, we’re human. If we were in the cook's place, given the time and effort we have spent in making the dish we will tend to feel a bit biased towards it. Deep in our heart, we would like to believe that our dish is perfect. This unfortunately, is an ideal scenario. Something which is non-existent in the real world. Therefore, we would need someone experienced, neutral and unbiased for tasting our dish. Someone who can rightly detect any inherent flaws we might have inadvertently made in preparing the dish. Someone who understands what cooking and good taste is all about and also understands the customers’ needs. This would go a long way in ensuring that your dish is well received. The flip side is: if your dish isn’t well received, you can always blame the taster ... :)

The same is the case with Software Development. Software Developers and Managers must realize that no matter how expert they are in interpreting the requirements and coding and despite their best efforts, bugs and critical errors inadvertently creep in. Some might be minor or cosmetic issues, but some might be show stoppers and might ruin the software’s performance, costing the company a huge amount of money to make a fix. Like I said earlier, we’re only human. And developers do have the tendency to think that their code is infallible. Every Software team needs a good amount of specialized and experienced testers who can detect an inherent amount of bugs in the application. Like the specialized tasters, testers (pardon the synonym) help in reducing errors and improving software quality by making sure your software product performs as per specifications and meets the end users’ requirements. As I mentioned earlier this kind of testing is a full time job which requires loads of patience, perseverance, meticulousness, creativity, a sharp eye for defects and various other positive adjectives. Having a good knowledge of coding makes you a good programmer but does not necessarily make you a good tester. And of course; if things do go wrong in production … you always have the QA team to blame …. :).
There are of course some areas where coding expertise is required, such as Automation testing. But there again, a good record and play tool eliminates the need for complex scripting. And as I mentioned in an earlier blog post (Manual V/s Automation), a good round of manual testing is required before you can proceed for further testing such as Automation and performance.
So whether you like it or not, Dev guys; wake up and smell the coffee. You will need testers to examine your code.

Asking your tester to code is like asking your number 11 batsman to score a century each time he comes out to bat. When there are runs required to be scored and wickets are few in hand, your batting skills will come in handy. But that's not always applicable. You have specialist batsman to do the job and if they have let you down then you cannot blame the tail-enders for not scoring runs always. As in software, each person in a team should have a core skill (batting, bowing, wicket keeping) and he should stick to it and develop it well.  

This is an open request to all IT companies, big or small to let go of their obsession for testers with coding knowledge. This attitude has made testing an endangered profession as it is. If this attitude persists the day is not far off when testing and QA will be added to the extinct professions’ list. You ignore specialized testers at your own peril. In the long run, the effects on Software Quality will be there for all to see.
   

Thursday, December 10, 2015

Installation and setup of Appium tool for Android via JAVA

Hi folks. Hope you're all in good spirits. For those of you into automation, desktop or mobile: Open source tools rule. And they rule because they are, well ... Open source. Open source tools are freely available for use by all. And what's more, if you are well acquainted with these tools, you'll find your career graph shoot up exponentially. Unfortunately, since they are open source there's not much of documentation and support available for them online. Most of these tools are updated and documented by programmers passionate about these tools and software in general. Hats off to them.

There are numerous open source automation frameworks available these days for automating Mobile and Web apps. Appium is one such popular tool. It can be used to automate native, hybrid and web based apps and pages on iOS, Android and FireFox OS operating systems.

In this blog, I will outline the steps required to install and setup Appium for automating Android application using JAVA on your Windows machine. This blog will cover the following topics:

  1. A brief introduction to Appium and it's features
  2. Pros and Cons of using Appium
  3. Tools required to run Appium
  4. Installation and setup of Appium (for running tests via JAVA)

Why Appium?


Pros

Appium has the following advantages:

  1. Appium is open source and free. All supporting tools required for setting up the Appium Test Framework are open source and can be downloaded from the net. There are no licensing and fees involved.
  2. Appium can automate a wide variety of apps supported on major mobile Operating Systems such as Android, iOS and FireFox OS.
  3. Appium supports the Selenium Web Driver framework, so users can script their tests in various Web Driver Compatible languages such as JAVA, Python etc and also use Selenium WebDriver Libraries.
  4. Appium scripts are cross-platform compatible. A Script created for Android can also be used for iOS as well(with a few tweaks of course).
  5. User does not require the source code for running tests.
  6. User does not need to recompile the app again for running Appium tests. This means that your app is tested as is in real world conditions.
  7. Appium is supported by proprietary cloud based test frameworks such as Saucelabs which can run your tests on Simulators close to actual device requirements
  8. There is no need to Jailbreak or root the device for running Appium Scripts
  9. Appium provides a wide range of versatile functionalities for running tests.  

 Cons:


Appium has the following disadvantages:

  1. Appium setup is a bit complicated and time-consuming, especially for first time learners.
  2. Appium cannot support OS below 4.2
  3. Appium does not have a record and playback tool for Windows
  4. Appium is not very stable at high loads.

Appium Architecture


Appium is actually a server written in Node JS. Clients initiate a session with the Appium server by ending a POST request with instructions (containing the code for tests to run). Settings required to run the test are sent to the server through the 'Desired Capabilities' object. After receiving the request, Appium sets up a session on the server with a unique session ID. User can now send multiple test requests for execution after the server is setup. For Android, Appium uses the UIAutomator framework and sends a HTTP response to the client.


Installing and setting up Appium on your windows machine for Android Tests  


Installation and proper setup of the Appium test framework is the most crucial and complicated step for running your Appium Tests. Without proper setup, you will not be able to run your Appium tests. What makes the setup process complicated is the dependency the Appium tool has on other third party and open source applications and software. Apart from the actual server application (Appium.exe) itself, you will require installation of various other third party tools for proper execution. The entire installation and setup process is mentioned below:

 

Tools required for setting up Appium


 

Appium.exe

 

This is the windows Appium server application. It can be downloaded via the Official Appium WebSite.

For downloading the latest Appium Server app, follow the instructions below:

  • Open the Appium Website.
  • Click on the 'Download Appium' link seen on the website. This will automatically start the download of the latest version of the Appium application

 

Node JS


The latest version of Appium has Node JS included which automatically installs along with the Appium server installation. If you are using an older version of Appium then you need to install Node JS on your machine. It can be downloaded and installed from the official Node JS website. 

 

JAVA - JDK & JRE


The latest version of the JAVA SE Development Kit (JDK) needs to be downloaded from the Oracle Website.




 

Eclipse


Download the latest Eclipse tool for scripting and executing your JAVA code. Download from the Eclipse Website.


 

Setting up Environment and System variables for JAVA


After installing JAVA and eclipse, you need to set the proper path for JAVA via the Environment variables window. Click on the Windows Start button. In the Start menu right click on 'My Computer' and select 'Properties'.



This will open the 'System Properties' page. Click on the 'Advanced System Settings' link seen in the left hand side of the page. This will open the 'System Properties' window. Click on the Environment Variables button at the bottom.


Here you will see two types of variables, user variables and system variables. User variables are settings for the specific user only. System variables are variables for all users accessing the machine. Choose any type of variable as per your needs.


Create new System variable 'JAVA_HOME' and set value to your JDK installation directory.

In the PATH system variable, add the following parameter:

<Path to your JDK folder>\bin

Eg: C:\Program Files\ Java\ jdk1.8.0_40\bin

 

Android SDK


Go to the relevant Android web site and download the latest Android Software Development Kit for your machine. SDK zip gets downloaded. Extract the same on your machine and make a note of the path.

 

Setting up Environment and System variables for ANDROID


Go to My Computer >  Properties > Advanced System Settings > Environment Variables

Create a new system variable ANDROID_HOME and set the value to the path where the SDK is extracted on your machine.

ANDROID_HOME: <path to your SDK folder>\sdk

Ex: ANDROID_HOME: D:\Work\android_sdks

The edit the 'PATH' system variable and add the following values to the same:


  • %ANDROID_HOME%/tools
  • %ANDROID_HOME%/platform-tools

 

 

Enable developer 'Options' on your device or Emulator


In case developer options are not enabled on your emulator or android device, enable the same by going to Device Settings. Tap on the 'About Phone' link 6 times. Developer options will appear. If your phone is connected to PC, your device will be prompted to accept an RSA key for linking between device and PC. Accept the same. This will ensure that your device  /emulator is properly linked to your PC / Laptop.

Download and Install PdaNET software (optional)

Go to the PDA website. Download and install the latest version of the Software PdaNet+. This will install the latest drivers for your phone. This will ensure that your phone is detected in the Android Device Monitor. Use this option if your laptop does not detect and install the mobile device USB drivers automatically.



 

Microsoft .NET framework version 4.5 or above


MS.net is essential for Appium to function. Go to the .NET download page and download version 4.5 or later.


Selenium WebDriver Files


Go to the Selenium Website, download and extract the following files to any safe location on your PC / Laptop:

a) Selenium Standalone Server file (Jar file)
b) Selenium Client and WebDriver Binding files for JAVA




 

 

Appium language bindings for JAVA


Last but not the least, we have to download the Appium JAVA binding file for JAVA. It's a JAR file and can be found at the following location:





Now you have all the files you require for setup. Now let's look into the installation of the Appium server for running our automation Scripts.



Setting up your Appium Test project in Eclipse



  1. Download the APK to be tested to any safe location on your PC / Laptop. For this example, we are going to automate the simple Android calculator for this sample project test.
  2. Extract and download the Selenium Standalone and WebDriver files to any location on your PC. Note the location.
  3. Open Eclipse. Start a new JAVA project. Click on New > JAVA Project



        4. Create a new JAVA project for ex: "NewAppiumTest"

        5. Create a new package ex: 'AppiumTest'

        6. Create a new class file ex: 'AppiumTest' (or any other name as per your choice).

        7. Right click on project folder and Select Build path > Configure Build path.

        8. In the JAVA build path window, switch to 'Libraries' tab.

        9. Click on the 'Add External JAR's' button and add the following JAR files:

             a) The Latest Appium JAVA binding file

                 




























              b) The latest Selenium JAVA Web Driver JAR file:





























             c) All the jar files in the /libs folder





























              d) The selenium server standalone JAR file





























      10. Connect your device to your PC/Laptop via USB. Ensure that USB debugging is ON.



Executing your First Appium Script

 

Congratulations. The Appium setup part is done. You are now ready to execute your first Appium Script. For this demo we are going to use the simple Android Calculator application. Place the file at any desired location on your PC / Laptop and remember it (Ex: D:\Radio\AndroidCalculator-V1_0.apk)

Import the Selenium WebDriver and Appium Driver libraries to your Appium Script:

 

import io.appium.java_client.AppiumDriver;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;

import org.openqa.selenium.remote.RemoteWebDriver;
                    
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;


Importing these libraries will call Web Driver interfaces and classes for running tests.

Note: Not all the libraries imported will be used in your test script. But it is better you import all of them to avoid any run-time compilation errors.

Create the methods for scripting your tests:



public static void main(String[] args) throws Exception {
          // TODO Auto-generated method stub
          // creating a class object
       AppiumTest testcases = new AppiumTest();
         // call launch app method
         testcases.launchCalc();
         // call add name method
         testcases.addName();

}          



Setup the Android APK file path:


public void launchCalc() throws InterruptedException, MalformedURLException
         {
         
File app=new File("D:\\Radio\\AndroidCalculator-V1_0.apk");


Initialize the test method. Remember the path to the Android APK you want to test and setup the path accordingly.



Set the Desired Capabilities:


Desired capabilities are a set of values sent to the Appium server which define the parameters for the test to be executed. They are setup in the following manner:


DesiredCapabilities capabilities = new DesiredCapabilities();

//Name of mobile web browser to automate. Should be an empty string if automating an app instead. 
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");

//which mobile OS to use: Android, iOS or FirefoxOS
capabilities.setCapability("platformName", "Android");

//Mobile OS version – in this case 4.4.2 since my device is running Android 4.4.2
capabilities.setCapability(CapabilityType.VERSION, "4.4.2");
                

       

           //device name – since this is an actual device name is found using ADB devices command in CMD
         capabilities.setCapability("deviceName", "92268ee10561a040");


         //the absolute local path to the APK

         capabilities.setCapability("app", app.getAbsolutePath());



         //Java package of the tested Android app
         capabilities.setCapability("appPackage", "com.calculator");

         // activity name for the Android activity you want to run from your             . This need to be preceded by a . (example: .MainActivity)
                                                          capabilities.setCapability("appActivity", ".Main");
 
 

Note: 

  • Device name can be detected by entering the command 'adb devices' in your command prompt window.
  • Your Android App package name and Main Activity name can be detected by using the following command:
           aapt list -a "path to apk"> file.txt
          Alternatively, loading the APK in Android settings of the Appium tool gives the package and 
          the main activity info also. 

Starting your test


Initiate your test by adding the following:


// constructor to initialize driver object

driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
 
This is the default port number from which the Appium Server will be initialized.

Detecting Elements on your Android App


Elements can be detected by using the UI Automator application. This application is found in the 'tools' sub folder of your Android SDK folder. To detect the element, open UI Automator and take a screenshot of the page on which the script is to be run.


The right hand side of the UI Automator application shows all the elements of the page grouped by classes. Click on the desired element in the screenshot. The bottom right hand side window will populate with all the details of the selected element. For example, click on the text window under the text "Enter First Number". The element gets highlighted by a red rectangular colour. You will see the element details populate on the bottom right side table. Since we are using Selenium Web Driver libraries and classes, we can use the 'findelement' method to detect and select elements using various parameters such as 'Class', 'Name' or 'Id'.

To detect and select the element, first create a WebElement object and assign the relevant method to it:

For example:



//locating the First text box
WebElement FirstNo = driver.findElementById("EditText01");

Here, EditText01 is the element id if the first text box. You can click / activate the text box and enter a value in it by using the following commands:

//Clicking the First Text Box and entering the value

FirstNo.click();
FirstNo.sendKeys("56");
 
This will activate the First text box and enter the numeric value '56' in it.

You can create a similar script for locating the second text box and entering a value it in:

          //locating the second text box

WebElement SecondNo = driver.findElementById("EditText02");
 



//Clicking the Second text box and entering the value
           SecondNo.click();
           SecondNo.sendKeys("65");

Similarly, create an object for the multiply button, select it and click on it by using the following code:


//Select and click the multiply button

WebElement Multiply = driver.findElementByName("Multiply");
Multiply.click(); 

This should click the 'Multiply' button and display the result of the product of '56' and '65'. After your test is done, use the following command below to exit the script cleanly and end the test.


driver.quit();
Optiona: You can import TestNG assertions and add an assert to make sure that the result is as per specification.
 
Your complete Appium Script should look something like this:


package <Your Package name>;

import io.appium.java_client.AppiumDriver;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.junit.*;
import org.openqa.selenium.remote.RemoteWebDriver;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;

import org.testng.annotations.Test;




public class AppiumTest {
      
       AndroidDriver driver;
      
       public static void main(String[] args) throws Exception {
              // TODO Auto-generated method stub
              // creating a class object
           AppiumTest testcases = new AppiumTest();
             // call launch app method
             testcases.launchCalc();
             //Start GlobalMenu
             //testcases.launchGMenu();
             // call add name method
             testcases.addName();


}

       public void launchCalc() throws InterruptedException, MalformedURLException
         {
         
          File app=new File("D:\\Radio\\AndroidCalculator-V1_0.apk");
            
          
          
           DesiredCapabilities capabilities = new DesiredCapabilities();

         //Name of mobile web browser to automate. Should be an empty string if automating an app instead.
         capabilities.setCapability(CapabilityType.BROWSER_NAME, "");

         //which mobile OS to use: Android, iOS or FirefoxOS
         capabilities.setCapability("platformName", "Android");

         //Mobile OS version – in this case 4.4 since my device is running Android 4.4.2
         capabilities.setCapability(CapabilityType.VERSION, "4.4.2");

         //device name – since this is an actual device name is found using ADB
         capabilities.setCapability("deviceName", "92268ee10561a040");

         //the absolute local path to the APK
         capabilities.setCapability("app", app.getAbsolutePath());

         //Java package of the tested Android app
         capabilities.setCapability("appPackage", "com.calculator");

         // activity name for the Android activity you want to run from your package. This need to be preceded by a . (example: .MainActivity)
         capabilities.setCapability("appActivity", ".Main");

         // constructor to initialize driver object
         driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
           Thread.sleep(4000);
           System.out.println("App Launched");
           //locating the First text box
           WebElement FirstNo = driver.findElementById("EditText01");
           //Clicking the First Text Box and entering the value
           FirstNo.click();
           FirstNo.sendKeys("56");
           Thread.sleep(2000);
           //locating the second text box
           WebElement SecondNo = driver.findElementById("EditText02");
           //Clicking the Second text box and entering the value
           SecondNo.click();
           SecondNo.sendKeys("65");
         //Select and click the multiply button
           WebElement Multiply = driver.findElementByName("Multiply");
           Multiply.click();
           Thread.sleep(10000);
           driver.quit();
          
         }
      
       public void addName() throws InterruptedException {
            System.out.println("Test success");
                // write all your tests here
          
           
          }

}


Since the actual test runs very fast, I have added a few thread.sleep methods to pause the test in between, so that you can get a better idea of how the test runs and to give the app some breathing space (Phew!)
 

Starting the Appium Server


This step is crucial to running your tests. Without this, your tests will not execute. Start the Appium.exe application on windows. Click on the 'Android' button to set the Android settings.


Click on the 'Choose' button, browse and select the APK to be tested. App package and Main Activity details will be displayed automatically. Enter device name as derived from the command 'adb devices' in CMD.

Click on the general settings icon and check the server number and port number from which the Appium server will be launched.

Now click on the 'Play' button on the top right corner of the Appium window. This will start the Appium server. The Appium server will look like below:


Now run the JAVA test you have in Eclipse and watch the result on your device.

Here we have reached the end of this blog. Hopefully, you have learned something useful from this blog and hope this helps you install and run Appium Scripts smoothly.

There is more to this. In my next blog, I will take up other commands and reporting via Test NG etc. Stay tuned !!

Thank you for taking the trouble to read this blog. Comment and criticism are always welcome.

Enjoy !!