Automated Software Testing

Part 1/1: This blog is to explain and help you understand what is automated software testing, where do we use it, what makes it a preferred choice over manual testing,how is it performed currently and its limitations

First of all, let us understand what do we do in manual testing?? A test engineer will manually test the software (under test) – Pretty simple right! So what is that we do different in Automated testing?? The same testing action is performed using a script with no manual intervention. It means that the automation script here performs the action which is generally done by a human (engineer). This automation script can be in any of the existing programming languages like Java, Python, Ruby, Pearl, etc. Choice of the script language can be based on the requirement, applicability of the need, skill set and proficiency of the automation testing engineer with that particular programming language.

So the next question that might arise is where all we can use automation testing ?

It can be used to automate web, mobile, desktop applications and APIs (Application Program Interface). This covers almost all areas of testing requirements. Isn’t it?

Though automated testing can perform the same action as manual testing, why should one get convinced to use it? One need to understand the merits of using it so that you can start using automated testing wholeheartedly.

Let me list down top 3 features of  automated testing to help you evaluate its merits and have an informed choice.

1.) Fast and time saving – For any given set of test scenarios, Automation testing is much faster than manual testing. This in turn results in huge time savings as all test scenarios are tested at comparatively very less time.

2.) Wider test coverage – All possible test scenarios may or may not be covered in case of manual testing. Whereas automated testing enables better and wider test coverage. This is made possible with the comprehensive testing script which ensures that all scenarios are covered vis-a-vis scenarios tested on sampling basis in manual testing.

3.) Better accuracy – Manual testing is prone to human errors since it involves testing of similar scenarios which is repetitive and mundane in nature. This can be prevented in automated testing making the test results more accurate.

I hope this gave you a fair idea of why to go for automation testing. Now moving to the how part of it – Let us see an example to understand this clearly – eg. Test scenario is to log in to Gmail and verify whether the username is seen in the homepage (i.e the default inbox page)

One would have to go through the below steps in Manual Testing:

  1. Navigate to Gmail login URL
  2. Type username
  3. Type password
  4. Click login
  5. Verify whether the username is displayed in inbox page

Now, let us see how the same thing can be done in automation testing:

Before performing the actual automation testing, it is important to understand some essential steps:

1. Tell your  script to identify a field

Automation test script does not have the ability to identify things like username input field box, password input field box or the login button unlike humans (i.e.manual tester). So we need to teach the script (see this is how you end up talking to machines when you do too much coding :P) to identify the username, password or submit fields based on their attributes like name, ID, Xpath, CSS path, etc. (For beginners who are wondering what these attributes are?! – these attributes are nothing but identifications for a field. Each field in a html page will have multiple attributes associated to it – something similar to what we humans have as name, identification marks, aadhar number, etc.

So now you know how to teach/tell your script to identify any particular field.

2. Tell your script what action to perform

To send commands/actions to a field in a browser, any available web automation testing tools like Selenium Webdriver can be used. Almost all actions which can be done manually can be done using web automation testing tools. Selenium webdriver supports numerous programming languages including C#, Java, Python, Pearl, PHP and Ruby.

3.Now lets us write automation test script for the above manual steps using Java-Selenium.

Assumptions: Tests are executed in Firefox browser and the identifiers seen here are for example only

We can use firebug or chrome dev tools inspector to identify the attributes for any element. Using any of these we identified the attributes as follows:

Identifiers:

username=//*[@id=’username’]

password=//*[@id=’password’]

login=//*[@id=submit]

inbox_username=//*[@=’inboxusername’]

Pseudocode,

public class GmailLogin{

FirefoxDriver driver;

public void initializeDriver(){

//opens firefoxdriver

FirefoxDriver driver=new FirefoxDriver();

driver.manage().window().maximize();

}

public void loginToGmail(){

//Finds username element

WebElement username=driver.findElement(By.id(username));

//Type alex in username field

username.sendKeys(“alex”);

WebElement password=driver.findElement(By.id(password));

password.sendKeys(“password”);

WebElement loginButton=driver.findElement(By.id(login));

//Click on submit button

loginButton.click();

WebElement usernameIbx=driver.findElement(By.id(inbox_username));

//Verify username in present in the inbox page

if(usernameIbx!=null){

Log(“Username is seen in the inbox page”)

}

}

public static void main(String[] args){

initializeDriver();

loginToGmail();

}

}

Hope you understood how manual test steps gets converted into automation test steps.Though automation has lot of benefits as we discussed before, it has its own challenges/limitations.

  1.Programming language skill is required to write the above script

  2.Since Automation framework implementations are very lengthy, one will always be lagging at-least 2 release cycles behind

  3.We do need to understand that not all manual scenarios can be automated.

With these set of known challenges/limitations, we shall be discussing on how to overcome these in our next blog. Do stay tuned…

2 thoughts on “Automated Software Testing

Leave a Reply

Your email address will not be published.