top of page
Gokul Palanisamy

Test Automation Framework

Updated: Sep 3, 2021

This blog is to explain and help you understand what is test automation framework, where do we use it, what makes it a preferred choice over manual testing, how is it performed currently, and its limitations


Test Automation Framework

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 differently 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, the 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 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 needs to understand the merits of using it so that you can start using automated testing wholeheartedly.

Let me list down the 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 the 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 a 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 on 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 on 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 get converted into automation test steps. Though automation has a lot of benefits as we discussed before, it has its own challenges/limitations.

  • Programming language skill is required to write the above script

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

  • We do need to understand that not all manual scenarios can be automated Read our next blog on The 5 pillars of responsible and ethical AI


Recent Posts

See All

Kommentare


bottom of page