aiShare Your Requirements
Aditi Nahar Oodles

Aditi Nahar (Manager-Project Manager)

Experience: 11+ yrs

Aditi is a certified QA Engineer with a strong command over management tool sets like JIRA and Trello, as well as QA tool sets for API and performance testing. She possesses excellent verbal and written communication skills and has gained valuable experience in management and leadership while collaborating with clients and large teams. Aditi's ability to apply creative thinking and problem-solving skills makes her adept at handling challenging business scenarios. Her proficiency in manual testing has proven instrumental in identifying issues and ensuring the functionality of applications across web, mobile, and TV platforms. She has made significant contributions to both internal and client projects, including Bits2Btc, AUS-BTC, EZBitex, ACL EAP, Scaffold, Iron Systems VRP, Oremus Zoho, and NOWCAST OTT.

Aditi Nahar Oodles
Aditi Nahar
(Project Manager)

Aditi is a certified QA Engineer with a strong command over management tool sets like JIRA and Trello, as well as QA tool sets for API and performance testing. She possesses excellent verbal and written communication skills and has gained valuable experience in management and leadership while collaborating with clients and large teams. Aditi's ability to apply creative thinking and problem-solving skills makes her adept at handling challenging business scenarios. Her proficiency in manual testing has proven instrumental in identifying issues and ensuring the functionality of applications across web, mobile, and TV platforms. She has made significant contributions to both internal and client projects, including Bits2Btc, AUS-BTC, EZBitex, ACL EAP, Scaffold, Iron Systems VRP, Oremus Zoho, and NOWCAST OTT.

LanguageLanguages

DotEnglish

Bilingual

DotHindi

Fluent

SkillsSkills

DotUML Diagrams

60%

DotQA

80%

DotZoho

80%

DotSystem Modeling

60%

DotAutomation Testing

40%

DotAPI Testing

80%

DotSelenium with Java

40%

DotConfluence and Jira

60%

DotDatabase Testing

40%
ExpWork Experience / Trainings / Internship

Apr 2017-Present

Project Manager QA

Gurgoan


Oodles Technologies

Gurgoan

Apr 2017-Present

Apr 2016-Dec 2016

Test Engineer

Delhi


KHD Humbolt

Delhi

Apr 2016-Dec 2016

Feb 2015-Jan 2016

Test Engineer

Ajmer


Toshniwal Industries

Ajmer

Feb 2015-Jan 2016

EducationEducation

2006-2010

Dot

Government Engineering college, Ajmer

B.Tech-Electronics Instrumentation & Control

certificateCertifications
Dot

Certified Tester Foundation Level

ISTQB

Issued On

Jan 2017

Top Blog Posts
About Headless Browsers and Headless Testing In this article, I will discuss Headless browsers, why to use them and when not to use them, what is Headless testing and its importance. And lastly an introduction and use of Headless Chrome tool. Introduction Headless Browsers are web browsers which don’t have a head or GUI (Graphical User Interface). This means a program runs at the backend to access the web pages but nothing is seen on the screen. Why use Headless browsers? To run tests on headless systems like Linux operating system without GUI. To run tests parallelly on multiple browsers on a single machine. To utilize minimum resources as GUI is not there. Need to run the test just for data creation and not for actual testing. When not to use these browsers? Where there is a need to visually observe the tests on the browser. As everything is running on backend and nothing is seen on the screen and UI is not a part of testing so it does not give the exact feedback of what users will actually experience on the website. Sometimes errors thrown by Headless browsers are not observed on real browsers. Introduction to Headless testing and its importance Headless testing is a method through which browser UI tests can be executed without the head, which implies that there is no browser GUI for running the tests. This is helpful in environments where running the tests does not require the GUI, for eg in a CI environment. With headless browsers, tests execution is fast in a real browser environment so it offers high performance. What is Headless Chrome? Headless Chrome is one of the tools which helps in Headless testing on Chrome browser. It can be used in the latest versions (59+) of Google Chrome. It makes it possible to interact with the websites without having a window on the screen. To work with Headless Chrome, only a terminal and the latest version of Google Chrome is required. chrome --headless --disable-gpu Let’s see some example of basic operations by Headless Chrome: 1. To create PDF of a page. chrome --headless --disable-gpu --print-to-pdf <webpage URL> The result to this will be a pdf file of webpage titled as output.pdf. 2. To capture a screenshot of a page. chrome --headless --disable-gpu --screenshot <webpage URL> The result to this will be a screenshot of webpage titled as screenshot.png. To take a screenshot of a custom size, --window-size flag needs to be added to the command. chrome --headless --disable-gpu --screenshot--window-size = 1290,1690 <webpage URL> Hope this article will help you in dealing with Headless browsers and headless testing.
How to configure JMeter to use client side certificates In this article we will discuss about how to configure JMeter to utilize client side certificate to confirm each request. This will make each request signed and encrypted. I believe readers are well aware about the JMeter tool and HTTP request protocol. INTRODUCTION HTTPS request is placed by using HTTP protocol, and then covering it with a SSL encryption layer over it. In this case, Servers clients still talk the very same HTTP to one another, however over a protected SSL layer. SSL layer provides encryption and decryption of server and client request & response. Handshaking is used to set up SSL connection between server and client. After the contact is established between server and client, server has to provide its identity to the client through a certificate. Also, in cases client is required to prove its identity to the server. And these are called client side certificates. Basically, client side certificates are utilized to authenticate the users. To place HTTPS request through JMeter, there is a need to use client side certificates. JKS (Java Keystore) and PKCS12 are storage for security certificates. These certificates are supported by JMeter. PKCS12 certificates have extension as .p12 and JKS file as .jks. In order to make sure that Java reads all the certificates, they are kept in Java Keystore. Now we look into the following steps to complete the entire configuration process of JMeter: 1. Making a Java keystore file (eg. keystore.jks) In order to convert .p12 file into .jks file, following command is used: keytool -importkeystore -srckeystore certificate.p12 -srcstoretype PKCS12 -srcstorepass <certificate_password> -keystore <keystore_filename> -storepass <stored_password> 2. Reaching to JMeter directory and opening system.properties file Here, to match the file values we need to uncomment the following lines: javax.net.ssl.keyStore=<JKS_filename.jks> javax.net.ssl.keyStorePassword=JKSpassword 3. Configuring JMeter To utilize personal keystore to sign HTTPS request though look complex but is a very simple process. Lets understand this further in steps: Step 1: Create a simple Test plan with a thread group Step 2: Add HTTP Request sampler for placing request on server Give careful consideration to the Implementation and Protocol fields . Step 3: Now add Keystore Configuration element under HTTP Request cert_name is not a variable name. JMeter here takes only the variable name and for this csv file and JMeter element CSV data set config. is used. Step 4: Add CSV data set config under thread group and pick value of variable name from csv file : Place JMeter script file .jmx and csv file at the same location. This solution is very good if we have lot of certificates and lot of variables. Step 5: In the final step, point JMeter at the keystore we need to utilize. Click Options --> SSL Manager and select the <keystore_filename> keystore that we made and press Enter. After doing all the setup, we run the script, enter password set for keystore password and each request now placed JMeter will be signed. Happy Testing:)
File Uploading with Apache JMeter Uploading and Downloading a file in web application is very common functionality. JMeter tool provides the feature of file upload and download and thus makes possible to perform load testing of this feature. This article is about how file upload is performed with JMeter. I believe users are well aware about the JMeter which is a load testing tool. Introduction: HTML form based file upload with JMeter is not always easy. But don’t worry this blog will make it simple for you. JMeter provides a means to check file upload as a part of test plan and thus behaviour of the application under load can be checked by increasing the number of Threads/Users in the test plan. Creating the Test Plan in JMeter for File Upload: 1. Let’s first start with Launching the JMeter and creating the Test Plan : Right click on Test Plan -> Add -> Threads -> Thread group 2. Add HTTP Request Sampler for placing the request on server : Right click on Thread Group -> Add -> Sampler -> HTTP Request 3. Add Listener for analysing the response from the server : Right click on Thread Group -> Add -> Listener -> Summary Report/View Results in Tree/View Results in Table. Configuring the HTTP Request Sampler for File Upload : 1. Add Server Name or IP and Port Number and path :/ 2. File Upload in JMeter is HTTP POST request therefore select Method as POST. 3. A multipart/form-data request needs to be placed on server therefore check multipart/form-data checkbox. Look at the HTTP Request Sampler: Next filling details in the Files Upload section of the HTTP Request Sampler : Click on Files Upload tab and hit the Add button to fill the following data: File Path - Path to the file which is to be uploaded (It is good if full file path is provided here). Parameter Name - Unique attribute of file type tag. MIME Type - Type of the file to be uploaded. For eg in case of text file, MIME Type will be ‘text/plain’, for image it will be image/plain’ etc. Here, we are considering the example of https://imgbb.com/ So, Let’s start first with placing the image file on JMeter bin folder. Now to find the parameter name, right click on ‘Start Uploading’ button -> Inspect and identify the unique identifier. Here it is ‘btn btn-big blue’. So, the values to be passed in the Files Upload section are : File Path - test.jpg Parameter Name - btn btn-big blue MIME Type - image/jpg After adding these values in the test plan, Save the test plan. Now before running the Test plan add the numbers of users in the thread group for which load scenario need to be executed and then Run it. In the next blog, I will discuss about file download with JMeter. Happy testing:)
How To Find Broken Links Using Selenium WebDriver Broken Links are a part of a website but it is very important to address them timely and regularly. In today’s article, I am going to discuss what are Broken Links, why they should not be there on a website and how to find these links on a webpage using Selenium Webdriver. I assume the readers of this article must have good knowledge of Selenium Webdriver automation tool. What are Broken Links? Broken Links are the links or URLs which are not executable because they are linked to an empty or non-existent webpage. Due to a variety of reasons a link can be non-functional or broken such as page is not available, domain is expired etc. A broken link can be External i.e it is redirecting to a webpage outside of the domain or can be Internal i.e. redirecting to a webpage of the same domain. What harm Broken Links can cause to a website? A broken link on a website leaves a bad impression on its viewers and therefore it can hamper websites reputation and business. As the links on web pages affect the rank of a website in search engine results. So, the presence of broken links can highly affect a website’s customer base and its revenue and thus can directly affect business. Looking into these serious consequences, broken links should be regularly detected and immediately handled. But a link cannot be confirmed as a broken one until it is clicked and response against it is checked. A website can have a large number of links so manually checking each link is a very tedious and time-consuming task. Therefore, here in this article, we will discuss how to complete this task with an automation tool. Let’s first check the Steps to find Broken Links on a web page: Find all the links on a webpage with tags <a> or <img>. Send HTTP request and get HTTP response from server against each link. Check through the HTTP response (eg 200, 400, 401, 404, 500) whether the link is valid or broken. Now let’s see the Implementation of these steps : // Import Packages import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; public class BrokenLinksHomepage { WebDriver driver; @BeforeTest public void beforeMethod() throws Exception { System.setProperty("webdriver.chrome.driver", "<ChromeDriver Path>"); driver = new ChromeDriver(); // Enter url. driver.get("http://www.homepage.com/"); driver.manage().window().maximize(); } @Test public void checkBrokenLinks() { List<WebElement> allLinks = findAllLinks(driver); System.out.println("Total number of elements found " + allLinks.size()); // Identifying and Validating URL for (WebElement element : allLinks) { try { System.out.println("URL: " + element.getAttribute("href") + " returned " + isLinkBroken(new URL(element.getAttribute("href")))); } catch (Exception exp) { System.out.println("At " + element.getAttribute("innerHTML") + "Exception occured -&gt; " + exp.getMessage()); } } } public static List<WebElement> findAllLinks(WebDriver driver) { // Finding all the links on homepage List<WebElement> elementList = new ArrayList<WebElement>(); elementList = driver.findElements(By.tagName("a")); elementList.addAll(driver.findElements(By.tagName("img"))); List<WebElement> finalList = new ArrayList<WebElement>(); for (WebElement element : elementList) { if (element.getAttribute("href") != null) { finalList.add(element); } } return finalList; } public static int isLinkBroken(URL url) throws Exception { // url = new URL("http://homepage.com"); int response; // Send HTTP Request HttpURLConnection connection = (HttpURLConnection) url.openConnection(); // Validating Links try { connection.connect(); response = connection.getResponseCode(); connection.disconnect(); return response; } catch (Exception exp) { System.out.println("Exception occured" + exp.getMessage()); return 404; } } } This implementation of finding Broken Links on a webpage is very simple. Try this and eliminate your manual efforts. Happy Testing:)
Data Driven Automation Framework with Selenium Webdriver In my earlier blog, I have discussed about Data Driven Automation Framework. This is a method in which test data and test script logic are kept separately. Thus a user can easily prepare a test data, modify it and also share it with other person. Today, in this blog I will discuss about Implementation of Data Driven Automation Framework in Selenium WebDriver. I assume readers of this blog are well aware about Selenium WebDriver automation tool and also what is Data Driven automation framework. My main focus is to discuss on how to create Test Data in excel sheet, how to import the same data in automation testing tool (Selenium) and further how to feed it to the software under test. Selenium WebDriver is a popular automation tool used for web-based applications. It uses third party api named Apache POI for performing read and write operations on excel files. Why Data Driven Testing is required? Although this I have already discussed in my earlier blog about Data Driven automation framework. In brief, I would say, if you want to execute the same test with different test data than this method is best in itself. It saves both time and effort and improves the efficiency. Also both the positive and negative test cases can be included into a single test. Tools/Softwares required to Implement Data Driven Testing? For implementing this testing, following are the prerequisites: - Java JDK - TestNG - Eclipse - Selenium jars - Microsoft Office - Apache POI jars Apache POI - Apache POI is the most common JAVA api used for reading and writing test data in excel files. It has many pre-defined methods, classes and interfaces. Interface in Apache POI - Apache POI supports both reading and writing data from xls and xlsx files. Following are some of the interfaces of apache POI: XSSFWorkbook: This represents workbook in xlsx file. XSSFSheet: This represents a sheet in XLSX file. XSSFRow: This represents a row in a sheet of XLSX file. XSSFCell: This represents a cell in a row of XLSX file. HSSFWorkbook: This represents workbook in xls file. HSSFSheet: This represents a sheet in XLS file. HSSFRow: This represents a row in a sheet of XLS file. HSSFCell: This represents a cell in a row of XLS file. Using Selenium with Apache POI - We’ll now understand how selenium and Apache POI can be used together for reading and writing data into excel files. Step 1 : Configuring Apache POI in eclipse. Download POI jars from the web, unzip them and add them in eclipse project. Step 2 : Creating Test Data in excel sheets. Create an excel sheet named ‘TestData.xlsx’ and save it at the preferred location. You can also save it under project’s package folder. Step 3: Reading test data from excel sheets. package <packagename>; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.concurrent.TimeUnit; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; public class ReadExcel { WebDriver driver; WebDriverWait wait; XSSFWorkbook workbook; XSSFSheet sheet; XSSFCell cell; @BeforeTest public void TestSetup() { // Set the path of the Firefox driver. System.setProperty("webdriver.gecko.driver", "<GeckoDriver Path>"); driver = new FirefoxDriver(); // Enter url. driver.get("http://www.linkedin.com/"); driver.manage().window().maximize(); wait = new WebDriverWait(driver,30); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } @Test public void ReadData() throws IOException { // Import excel sheet. File src=new File("<TestData.xlsx file path>"); // Load the file. FileInputStream finput = new FileInputStream(src); // Load the workbook. workbook = new XSSFWorkbook(finput); // Load the sheet in which data is stored. sheet= workbook.getSheetAt(0); for(int i=1; i<=sheet.getLastRowNum(); i++) { // Import data for Email. cell = sheet.getRow(i).getCell(1); cell.setCellType(Cell.CELL_TYPE_STRING); driver.findElement(By.id("login-email")).sendKeys(cell.getStringCellValue()); // Import data for password. cell = sheet.getRow(i).getCell(2); cell.setCellType(Cell.CELL_TYPE_STRING); driver.findElement(By.id("login-password")).sendKeys(cell.getStringCellValue()); } } } Through this program line by line test data will be picked after the test execution starts. Check the results in testNG reports. Step 4 : Executing the test cases To execute the test cases, right click on the test case class then select Run as - TestNG Test option. Before the actual execution, please keep in mind the following points: 1. All the required jars are added and properly configured to eclipse project 2. Installation of all the required softwares 3. Interfaces and classes are properly used i.e.HSSF for .xls and XSSF for .xlsx. 4. Usage of valid row and column index. 5. Excel file is not opened before execution. By using Data Driven framework in Selenium using POI, helps in reduction of maintenance cost and effort, also test coverage is improved which results in good return on investment. I hope this blog will save you from the tedious task of executing the same test cases again & again.
JMeter Graph Results Listener I believe you would have heard about the JMeter listeners and maybe probably used some of them. Today, in this article I am going to discuss JMeter Graph Results listener. JMeter, as you are aware of, is a performance testing tool and after doing testing, monitoring and analysis of different test results and parameters is the most important part. Thus, here come the listeners in the picture, they provide UI to view the sent request and response received from the server. These results can also be saved in files for later use or can be viewed live while the tests are running. What is Graph Results listener? Graph Results listener allow us to view the test results in the form of a graph. It generates a simple graph in which all sample time is plotted against the response time. This helps us in analyzing the result in less time and with more understanding. Now first let’s see how we can add this listener to our Test Plan: Step 1: Create a Test Plan Right Click Test Plan > Threads (Users) Set values of No. of Threads (users) as 1000, Ramp Up Period (in seconds) as 1 and Loop Count as 1. Step 2: Add HTTP Request sampler Right Click on Thread Group > Add > Sampler > HTTP request Give a Name to the sampler > Set Server Name, Port, HTTP Request Method, and Path (if required). Step 3: All Graph Results Listener Right Click on Thread Group > Add > Listener > Graph Results. Step 4: Save this Test Plan and Run the test. Now check the result on Graph Results listener. The result will be somewhat similar to as shown below: Here, the data in the bottom of the graph displays the current values in milliseconds. Black shows the current sample, Blue shows the current Average of all the samples, Red shows current Standard deviation i.e. deviation of the response time. It should be as low as possible. And Green shows current Throughput rate. The Throughput rate is the total number of requests handled by server per minute. This time includes total JMeter’s processing time and also if any delay is added to the test. So, we can say that the test produces some real data. The value on the top left of the graph is maximum of 90 the percentile of response time i.e. it shows the elapsed time below wich 90% of samples fall. We can save the graph result by specifying Filepath in Filename field under “Write results to file/Read from file”. I hope this blog will prove useful to you. Happy Testing:)
Understanding Test Automation Frameworks Part 3 In my last article, I discussed “structured scripting framework” which uses structured programming instructions like the control structures for controlling a different flow of the test cases or test scripts. In this article, I will discuss third automation framework i.e. “Data Driven Automation Framework”. I will explain in brief about this framework, how it is useful and Merits and Demerits in using it. Data Driven Automation Framework As the name says, in this framework, automation test scripts are driven by data i.e. data files are used to fetch input and output test values. The test data can be stored in any of the external databases like text files, xml files, excel sheets, csv files, property files. While testing an application it is required to test a functionality multiple times with multiple test data so, in that case, each test data cannot be put in test scripts as this will be time consuming and inefficient. Therefore, data is stored in external database thus segregating test data and test script logic. Test Scripting can also be done using Linear scripting framework. It is very convenient and useful to keep test data in external storages as a user can easily prepare it, modify it and also share it with another person. For eg have a look at the below table in which data is stored in an excel sheet. Each row holds a test data for one test script and can be checked or assigned. However, multiple rows can also be used. Now let’s have a look at the operations in a data-driven test 1. Fetching input data from the storage file. 2. Entering the same data into application script. 3. Writing back the output in the file. 4. Verifying the actual result with the expected Result. 5. Picking next set of input test data. In my coming blogs, we will see how to perform these steps with an example. Every framework has some advantages and disadvantages associated with them. Let’s see them for this framework: Merits: 1. Test script size is reduced. 2. Change in test data does not affect test script logic. 3. Code maintainability and flexibility increases. 4. Multiple test scenarios can be executed with a particular test script. 5. Supports better error handling as the function returns TRUE or FALSE values instead of aborting the script. Demerits: 1. Proficiency is required in writing the scripts. 2. Data files need to be maintained for each test case. 3. Data files need to be handled properly in order to avoid script processing errors. In my next blog, I will discuss the implementation of Data Driven Automation Framework with Selenium Webdriver. Hope you are enjoying reading about different automation frameworks. Happy Reading:)
How To Make GET Request Using RestAssured Framework Today I have a very interesting topic to discuss and that is Performing API Testing using Rest-Assured Framework. Before proceeding with this topic I assume the readers have good knowledge of TestNG Framework. In this blog, I will discuss briefly Rest-Assured Framework, Set up of Rest-Assured Jars in Eclipse Project and make a GET request using Rest-Assured. What is Rest-Assured Rest-Assured is a JAVA library which can be used for writing tests for RESTful APIs. It also has assertions for validating the API responses and forms a good combination with TestNG libraries. Steps to setup Rest-Assured Jars 1. Download and Setup Java, Eclipse and TestNG. 2. Download Rest-Assured Jars. 3. Create a Project in eclipse. 4. In the classpath of eclipse set Rest-Assured Jars. After the initial setup is done, let’s now understand how to make GET request with Rest-Assured Consider the following example: EndPoint - https://example.com/api/countries/<country> HTTP method Type - GET Response - { "countryId": 1, "name": "India, "capital": "Delhi”, "states": 29, "territories": 7, "phoneCode": "91" }, Comment - Above response is fetched for the country India. To fetch this response from Rest-Assured, following steps are to be executed: 1. Using Rest-Assured class, RequestSpecification is generated for the URL: https://example.com/api/countries/India 2. HTTP method is specified. 3. Request is send to server. 4. Response is received from server. 5. Response body is printed. import org.testng.annotations.Test; import io.restassured.RestAssured; import io.restassured.response.Response; import io.restassured.specification.RequestSpecification; public class Example { @Test public void listCountries() { // Using Rest-Assured class to setup a request RestAssured.baseURI = "https://example.com/api/countries"; // Getting the RequestSpecification of the request RequestSpecification httpRequest = RestAssured.given(); // Making GET request directly by RequestSpecification.get() method Response response = httpRequest.get(“/India"); //Retrieving Body of response String body = response.getBody().asString(); //Retrieving Status Code of response int status = response.getStatusCode(); //Retrieving Status Line String statusLine = response.getStatusLine(); //Printing the response System.out.println("Response Body is "+body); System.out.println("Status code is "+status); System.out.println("Status line is "+statusLine); } } Note: RequestSpecification is an interface and in a Rest-Assured library, all requests are represented by this interface. Above code is written considering positive test scenario but similar can be used for testing negative scenarios also. Try it by yourself and share. In my next article, I will share about making a POST request using Rest-Assured. Enjoy Automation Testing :)
Understanding Test Automation Frameworks Part 2 In my previous blog, I have discussed about “Linear scripting automation framework”, in which through the record and playback technique, testing step is captured and is written in a script file. In this article, I am going to discuss the next automation framework which is “Structured Scripting technique” . We will discuss what is this framework, how it is different from Linear scripting , its uses and pros and cons in using it. Structured Scripting framework Structured scripting uses structured programming instructions like the control structures. These are used for controlling different flow of the test cases or test scripts. ‘If-else’, ‘while’, ‘for’ and ‘switch’ are examples of control structures. These help in performing some steps in the scripts iteratively and in basic decision-making, that in certain conditions how the test will respond and whether it will pass or fail. This framework has the capacity of declaring numerous lines of code into one set of tasks which helps in code reusability and easy maintenance. The fact that the user has to define a function at only one place and can reuse it anywhere in the test script. Also it provides an ease in addressing the issue at only one place where it is defined. As with increase in functionality, scripts becomes more complex so code reusability becomes a more important part. Unlike Linear scripting framework, for implementing Structured scripting, only testing skills are not sufficient one has to develop his programming skills also. As linear scripting may give a large script with numerous lines and repetitive functions, so it needs good scripting knowledge to convert that code into few meaningful lines. Merits associated with it: 1. Supports code reusability unlike linear scripting. 2. Due to code reuse, cost of developing scripts is less. 3. Less maintenance of the script is required. Demerits associated with it: 1. Technical skills are required in writing the scripts. 2. Test planning and preparation requires comparatively more time. 3. Hard coded test data is used. In my next article, I will discuss about Data Driven Automation framework. Keep Reading:)
TestNG Assertions in Selenium In this blog, I will discuss TestNG assertions and how to use them with Selenium scripts.I believe readers have some basic knowledge about Selenium tool and TestNG framework. What is Assertion? The assertion is a checkpoint which can be used in between the test scripts in order to verify the test status against a test condition. In a simple manner, Asserts give us a way to test the expected result with the actual result. Asserts are most frequently used methods while creating Selenium WebDriver test scripts. Let’s understand how an assert is used: Test Case - We need to verify Page Title of an application named “Ezbitex’. If actual result matches with the expected one then the test passes otherwise it is marked as failed. We can understand this with the code below: @Test public void verifyPageTitle() { driver= new FirefoxDriver(); driver.navigate().to("http://ezbitex.com"); Assert.assertEqual("Ezbitex", driver.getTitle()); } In the first line, we are saying that any object passed to the driver (reference variable) will be an instance of FirefoxDriver class. In the next line, we are navigating to the application URL. And the third line is an Assertion. In this line, we are checking the page title. As it is matched, so the test gets passed. Now, If the same assertion statement is written as below: Assert.assertEqual("Ezzzzzzbitex", driver.getTitle()); Then this will throw an error: java.lang.AssertionError: expected [Ezbitex] but found [Ezzzzzzbitex] By using assert in the middle of the code we assure that a particular condition is true or false and then an accordingly further script is executed. Likewise, there are other assertions also in TestNG. 1. assertEqual(String actual, String expected): It accepts two string arguments and matches them, if both are equal then test gets passed but if not then it fails. 2. assertEqual(String actual, String expected, String message): It accepts three string arguments and matches them, if both are equal then test gets passed but if not then it fails and throws the message which we have provided. 3. assertEquals(boolean actual, boolean expected): It accepts two boolean arguments and matches them, if both are equal then test gets passed but if not then it fails. 4. assertEquals(java.util.Collection actual, java.util.Collection expected, java.lang.String message) : It accepts two collection objects and verifies them. If both contain the same elements with the same order then test gets passed but if not then it fails and throws the message which we have provided. 5. Assert.assertTrue(condition) : It accepts one boolean argument and verifies a condition. If it is true then a test is passed but if it isn't then an AssertionError is thrown. 6. Assert.assertTrue(condition, message): It accepts one boolean argument and one String message and verifies a condition. If it is true then a test is passed but if it isn't then an AssertionError is thrown with a message. 7. Assert.assertFalse(condition): It accepts one boolean argument and verifies a condition. If it is false then a test is passed but if it isn't then an AssertionError is thrown. 8. Assert.assertFalse(condition, message):- It accepts one boolean argument and one String message and verifies a condition. If it is false then a test is passed but if it isn't then an AssertionError is thrown with a message. Please have a look at the sample code and continue using Assertions. @Test public void verifyGooglePage() { driver= new FirefoxDriver(); driver.navigate().to("http://google.com"); Assert.assertEquals("Gooogle", driver.getTitle(), "Strings are not matching"); // a code to login and using a method ‘isUserLoggedInSuccessfully’ and ‘isUserLoggedOut’ which returns boolean. Assert.assertTrue(isUserLoggedInSuccessfully(), "User failed to login"); Assert.assertFalse(isUserLoggedOut()); } } After reading this blog I believe you must be pretty much convinced by the fact that Assertions play a very important role in test scripts. So try using them and make your work easier and smarter. Happy Testing :)