Categories
General Topic Information Technology Software Testing

Test Automation – How Selenium WebDriver works?

Welcome to brand new series on Test automation with Selenium. In this series, we will have a look at how we can automate testing of web application with Selenium.

Selenium is popular open source test automation tool. With Selenium, we can automate test scenarios related to black box testing, compatability testing, system testing, api testing, and regression testing.

Selenium Project has 3 flavours Selenium IDE, Selenium WebDriver, and Grid. Out of which WebDriver API is very popular in automation.Today I am going to focus on Selenium WebDriver.

How Selenium WebDriver works ?

Using WebDriver, we can drive browser and perform actions like Click, Open URL, Enter text, take screenshot etc.Typical test automation utilizes WebDriver API, language specific driver bindings, and test framework.

WebDriver does not directly interact with browser. Then how does WebDriver communicates with browser? It follows simple client server way of interaction. A proxy driver server sits between the client automation script in Java,Python, C# etc and browser. It is specific to the browser, such as ChromeDriver for Google’s Chrome, GeckoDriver for Mozilla’s Firefox, etc.

To run WebDriver script on chrome browser, we need to first start the ChromeDriver server by instantiating particular driver class.

using (IWebDriver driver= new ChromeDriver())

{ }

Then driver server launches the Chrome browser and starts listening on a particular port Listening on the port refers to accepting HTTP request which can be GET,POST etc.

For every selenium command, WebDriver creates a HTTP request and sends the request to the proxy driver server. All steps to be executed on browser are interpreted and executed by proxy driver server. It receives and sends back response from browser to client automation scripts.

For Ex : driver.Navigate().GoToUrl(“https://thealivecard.com/“);

Above command opens up specified Url in browser.

WebDriver uses JSON wire protocol for communicating between client and proxy driver server.

Test execution is facilitated by testing frameworks like NUnit, JUnit, MSTest etc. Testing framework provide features like test annotations, assertions which makes test automation easier.

For Ex : In NUnit, [Test] annotation marks method in test class to be executed as test

In NUnit, Assert class provides many methods to compare and verify test outputs

For Ex : Assert.AreEqual(link.Displayed, true);

Below is sample code assembled together to help you say Hello to Selenium 🙂

using System;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
namespace SampleTest
{
public class HelloSelenium
{

private const string HomeUrl = “https://thealivecard.com/”;

[Test]
public void LoadApp()
{
using (IWebDriver driver = new ChromeDriver())
{

driver.Navigate().GoToUrl(HomeUrl);
Thread.Sleep(3000); driver.quit()’

}

}
}

}

Hope this post will help you to get started with Selenium webdriver Next time , we will explore some interesting scripts in selenium test automation

Till then, keep testing Keep sharing

Categories
General Topic Information Technology Software Testing

Test cycle

Hello and Namaste…………Welcome to yet another post for software testing. In this post, we are going to know about how a typical test cycle functions.

After software requirements are understood and analysed well, developers write code. When development is completed, software developed is released to QA team for testing. A software is released as “build”. Build refers to process in which programs are compiled together to make tangible software component or product so that it can be tested for functional and non functional requirements.

A typical functional test cycle consists of smoke testing,testing change requests, regression testing, ad hoc testing, and retesting if applicable.

Smoke testing : Whenever software build with new features or enhancements or bug fixes is released, build is validated for critical functionality of application . If smoke scenarios aka critical functionality of application is working, then smoke test status is said to be pass and build is accepted for further QA examination. Otherwise if build fails smoke test is fail and build is rejected

Regression testting : In regression testing , software components influenced by new changes or features are tested in detail. Impact area is determined by scope of changes done. If changes done are limited to few components, then only relevant modules are tested otherwise whole system is tested to verify wheather changes done have affected any other functionality

Ad hoc testing : Ad hoc testing validates system in general. End to end scenarios are tetsed across application without focusing on any particular feature or module. Ad hoc testing is preferred if test cycle has limited time and impact of new changes is less

Retesting : Retesting of fixed issues is carried out for any of bug fixed and given for QA verification

Categories
Information Technology Software Testing

Types of software testing

Hola !! In today’s post we are going to have a look at types of testing

1.Compatibility testing

In today’s world , we have multiple devices , many flavours of operating systems and n number of dependent softwares to use one software. Behaviour of software application may differ depending on these factors. Compatability testing is crucial in understanding whether software functions well across different operating systems, web browsers, network, devices, hardware configurations, versions etc. Compatability also needs to be tested with respect to newer and older versions of related software applications

Some of the most common Compatibility testing defects for web applications are :

  • Differences in the user Interface with respect to look and feel
  • Changes with respect to font size, alignment issues, css styles, color, scrollbars
  • Broken Images
  • Information in tables is not displayed properly

To verify these kinds of issues , a website needs to be tested in different browsers (For Ex : Google chrome, Internet Explorer, Mozilla Firefox) on different operating systems(Windows, Linux,Android) in different devices(Desktop, Mobiles of different resolutions). We also need to consider different version of every operating system, web browser, devices in combination to ensure good user experience

2.Performance testing is part of performance engineering practices where system is examined for quality attributes like responsiveness, reliability, scalability etc. Performance testing validates system’s performance against predefined performance benchmarks for speed, memory, response time etc.

A performance bottleneck occurs when a single component’s failure results in slowdown or shutdown of an entire system. Identifying such an component requires quantitative and qualitative analysis of system under controlled conditions

Performance testing primarily includes stress testing and load testing Load testing checks system performance under specified load conditions while stress testing stimulates higher than expected load conditions to determine potential breakpoints. Stress testing includes soak testing and spike testing

A beautiful explanation of performance bottlenecks : https://www.apicasystems.com/blog/5-common-performance-bottlenecks/

3.Security testing

Security testing is an approach to identify vulnerabilities in information system to protect the system against incidents like data theft, functionality breach etc. A vulnerability is a weakness or a flaw in system that can be exploited by attacker to harm respective stakeholders or end users.Some common security threats are as follows :

1.Privilege Escalation : Most software applications have multiple user accounts. Each user has certain roles and permissions. Common permissions / privileges include viewing and editing files, install new programmes etc.Hacker creates an account on a system and uses it to increase his system privileges to a higher level which he/she was not suppose to have. These privileges can be used to delete files, view private information, or install viruses or malwares.

2.SQL injection : SQL injection is used to attack data-driven applications, in which malicious SQL statements are inserted into an entry field for execution (e.g. to dump the database contents to the attacker).For ex: Entering a single quote (‘) in any textbox should be rejected by the application. Instead, if a database error is displayed, it means that the user input is inserted in some query which is then executed by the application. In such a case, the application is vulnerable to SQL injection.SQL injection attacks are very critical as attackers can get vital information from the database.

3.URL Manipulation :URL refers to Uniform Resource Locator.URL is address of particular website on internet. For Ex : https://kinfolkclub.com/. URL manipulation, also called URL rewriting, is the method of altering the parameters in a URL and capturing important information. When the web application uses the HTTP GET method to pass information between the client and the server, data is passed in parameters in the URL An attacker can exploit this vulnerability by sending altered link to unsuspecting users via e-mail or by posting it on a website. When users click the link, they can be redirected to a malicious third-party site containing malware or inappropriate material.

4. Cross site scripting(XSS) : XSS enables attackers to inject client-side script into Web pages viewed by other users and trick a user into clicking on that URL. Once this script is executed by the other user’s browser, hacker can cause potential harm to user’s system.

XSS occurs when a web page displays user input — typically via JavaScript— that isn’t properly filtered.A simple test shows whether web application is vulnerable to XSS. Choose any field in the application that accept user input (such as on a login or search form), and enter the following JavaScript statement:

<script>alert('XSS')</script>

If a window pops up that displays XSS, the application is vulnerable.

5.Denial of service (DoS)attack : A denial-of-service (DoS) attack is accomplished by flooding the target system with excess requests to overload it and prevent some or all users to avail the services In a distributed denial-of-service attack (DDoS attack), the incoming traffic attacking the target system originates from many different sources. Hackers behind the DoS attacks often target sites such as banks, credit card payment gateways, retail stores

OWASP ( https://www.owasp.org/index.php/Main_Page ) is almighty reference for web information security concepts

4.Usability testing

Usability testing tests how easily users can use system. Usability is the measure of a product’s potential to accomplish the goals of the user. Goal of user refers to intention of user to complete a task. For Ex : Booking movie ticket or purchasing appliances online

In usability testing , users of a product are asked to perform certain tasks to analyze product’s ease-of-use, time to complete the task, and overall user experience. Participants are encouraged to share their every opinion. All feedback is noted and analyzed . The goal of Usability Testing is to create real world scenarios where the user will be actually using our product, then by observing their behavior we will be able to understand what could be done better.

5.Accessibility testing

Accessibility testing is a type of testing conducted to check if user with disabilities can use the software application with ease. Users with or without disabilities should have equal access to technology.People with disabilities use assistive technology which helps them in operating a software product. Example of assistive devices include Screen reader software that is used to read out the text that is displayed on the screen.

Accessibility testing tries to answer the questions like : Can screen reader identify all words? Do all images have alt descriptions? Are all page elements responding properly to keyboard keys?

W3C (World wide web consortium) provides Web content Accessibility Guidelines for a content to be presented on the web as below:

1.Information displayed should be perceivable

For ex : Every image, including icons, buttons, and graphics, video, charts, need to be properly tagged and described for a screen reader to show information properly.

2.User Interface and navigation of application should be operable

For Ex: A website needs to be navigable and interactive entirely through the the keyboard, which is essential for people who use a text browser or are unable to use a mouse for various reasons.

3. Consistent and effective organization of user interface elements can make use of application easier for users with different disabilities

For Ex : Forms can be confusing or difficult to use for many people, and, as a result, they may be more likely to make mistakes. To help users, we can include descriptive instructions, error messages, and suggestions for correction etc

4.Application should be compatible with newer and older versions of assistive technology

Adios for now….. In my next post, I will tell you more about how functional testing is conducted in a typical test cycle.

Till then , do like, share and subscribe to my blog 🙂

Categories
Information Technology Software Testing

Software testing : Approaches and levels

Today I am going to talk about approaches and levels of software testing

Testing aims to examine multiple facets of quality.There are two main approaches to test the software ie. Black box and White box testing

1.Black box testing

Software product is evaluated in the context of business or user requirements using black box testing .

Requirement refers to feature of software with help of which user of system completes certain task. For Ex : Booking a movie ticket

In black box testing, software tester does not have a knowledge of code written(box to be tested is black for tester). He /she tests application based only on functionality expected

For example : Requirement to test is that in movie ticket booking application, user should be able to search movie by name in movie list. Suppose user is on home page where there is search box for movie name and search button ,this scenario can be tested by just entering movie name and clicking search button and verifying movie names displayed as required.

2.White box testing

In white box testing , software tester understands the code written inside program (white box)and tests program with respect to code to target defects inside.

For example : In movie ticket booking application, a code to display movie list should display 10 movies on each page for every category of movie. Count of movies to be displayed can be reviewed by examining code of respective program.

Black box testing is more prevalent in software testing.

Till now , we have seen approaches for software testing. Now let’s see what are levels of testing.

1.Unit testing

In unit testing, individual units of software code are tested to verify it’s functionality. Unit test scripts are generally developed by developers using unit testing frameworks like NUnit, JUnit etc. A simple unit test case calls or simulates unit under test , sends required inputs and asserts actual output against expected output. Unit testing framework has features like reporting, which helps in automating unit test cases effectively.With optimal unit testing , we can achieve optimum code coverage which prevents functional defects.

For example :

Unit test for search movie name

In movie ticket booking application, a class ” Search “is written for Search feature. This class which has some properties and methods. One of the method to search movies is SearchMovieByName

public String SearchMovieByName (String name)

This method is called by another dummy method for ex: CallerMethod which verifies return data

public void CallerMethod() {

Search obj= new Search();

String result = obj. SearchMovieByName (“ClassicMovie”);

String st=” ClassicMovie “;

if(result.Equals(st))

Console.WriteLine(“Matching movie found”);

else

Console.WriteLine(“Matching movie not found”);

}

Search class can be unit tested for various input values for search box and expected movies details to be displayed depending on requirement.

2.Integration testing

Integration testing tests subsystem or system formed when two or more units of software product are coupled. Units so far developed and tested independently , may fail to function as expected when coupled together.

For example : When user makes payment for a selected movie show, program for ticket information is integrated with payment gateway processing program for which, we can test integration

3.System testing

System testing refers to testing application as a whole system. It examines functional requirements and it also verifies non functional aspects of system(For example : Performance, Stress, Accessibility etc). It is generally conducted by independent software testing team.

For example : In movie ticket booking application, end to end testing scenario of ticket selection to payment and ticket confirmation can be considered as system test scenario

4.User acceptance testing

In User acceptance testing (UAT) , the software is tested in the “real world” by the intended audience. UAT is final last phase of the software testing process, before the software is released to real word. In UAT, group of business or end users review system to verify functionality and find issues if any.In case if software follows any contract or regulation guidelines, relevant test scenarios are included in UAT.

Alpha testing and beta testing are also types of UATs. Alpha testing of ready to use software is conducted by in house testers or developers , before it is released to business users. Beta testing takes place at customers’ sites, where a group of customers or end users use the system and report observations and issues , before the system is released to live environment.

In next post we will have at look types of software testing . Keep reading. Keep testing.

Categories
Information Technology Software Testing

Introduction to software testing

Hello folks

In today’s blog post , I am going to tell you about software testing basics.

 What is software testing?

Primary goal of software testing is to find out defects in the context of requirements.

Software testing is a broad spectrum planned activity conducted by Quality Analysis team which includes quality assurance and quality control.

Quality assurance activities seek to prevent buggy code and Quality Control implements actual testing to find out defect.

Software testing is fundamentally using software as end user and finding deviations from what is expected , keeping in mind human perspective of software applications. Finding a bug in an application needs  good analytical abilities, observation, patience and of course a lot of questioning attitude. 😊

What is Defect ?

Defect is error state of software application that results in deviation from expected behaviour.

For example :

A login page has two fields Email and password and login button.

login

If user is able to login by entering wrong password, then this is a defect .

Objectives of software testing :

1.Uncover defects in software product

2.Verify conformance of product features to functional and non functional requirements

3.Undestand risks involved and implement steps to minimize risks

Different test techniques are used to derive feasible number of tests to be conducted as number of possible input and output combinations can be enormous for even simple piece of code

Software Testing Life Cycle

Software testing life cycle has phases phases :

Requirement Analysis − In this phase requirements to de developed are examined in detail.

Discussions and clarifications are conducted with respective stakeholders to analyse and document requirements.

Output of this phase can be requirement clarification document.

Test Planning – In this phase, Test Team plans approach of testing , scope of test effort , cost and resource estimates.

Scope of testing identifies implicit and explicit test items with respect to requirement clarification document.

Out of scope test items are also mentioned with respect to requirement being developed. Approach of testing identifies different test techniques to be used.

Test Case Designing – In this phase test scenarios and test cases are derived based on requirement. Test data is also identified for test cases.

Test cases are mapped to use cases or user stories in Requirement Traceblity Matrix to ensure optimum test coverage.

Output of this phase is Test case document

Test Environment Setup – This phase involves setting up a test environment as per hardware and software configurations required to test.

For Ex : Setting up local QA server or preproduction instance depending on phase of testing

Test Execution − During this phase, actual testing is carried out as per test cases prepared.

Test results are documented.

Defects are reported using Defect Tracking Tools.

Any fixed defects are also retested.

Test Closure – A consolidated test report is prepared depending on scope of testing effort.

Different test metrics are prepared to evaluate test effort conducted.

For Ex : defect density, number of test cases executed, number of test cases passed.

Hope today’s post helped you understand basics of software testing.

Keep watching  this space for more as we dive deep in an ocean of “software testing”.