The Complete Magazine on Open Source

Top 5 open source tools for optimising web apps

Open source tools to improve web app testing

Before a Web app goes live, it is advisable to have it tested for any potential bugs. Various types of tests have to be made on the app to ensure that it performs as expected. This article covers the basic principles of Web app testing and gives the reader a glimpse of the top five open source apps in this space.

A huge discount at any online shopping portal invites us to look around for bargains. Having chosen a stylish T-shirt (with the ‘50 per cent OFF’ tag), we click on ‘Make Payment’ only to find a message stating, ‘Not in stock’.The slow working of web application under heavy load due to which stock got over by the time we could make payment disappoints us greatly. This would not have happened if the shopping portal had undergone proper load testing and performance testing. Such issues can be observed in other Web applications too, if their performance has not been evaluated and optimised properly.

Web applications follow the SDLC (software development life cycle) process right from the requirements-gathering phase to their development, and then on to the testing phase until the final application is ready for deployment in production. Testing is one of the most important phases of the SDLC. During this phase, the developed Web application is tested against the requirements mentioned in the SRS (software requirements specifications) document. Various types of testing, such as functional testing, integration testing, system testing and acceptance testing ensure that the application addresses all the specified needs. Load testing and performance testing are also performed by creating different virtual users to ensure that the application gives optimised performance under heavy load conditions, ensuring that it is not affected by any parameter. The important aspects that are considered during the evaluation of any Web application are:

1. Validation of the Web link, with which the Web app can be accessed by users, as well as of different links that help users to switch from one page of the Web app to the other.
2. The look and feel of various GUIs present in each tab of the Web app.
3. The functionality of different GUIs present in each tab of the Web app.
4. Database testing for the database accessed by the Web application in order to ensure that the data fetched by the application is valid and correct.
5. Performance of the Web app on different browsers.
6. Evaluation of the other performance parameters of the Web application such as the login session, the app’s response
time, etc.
7. Performance of the app when many users hit it simultaneously (load testing).
8. Security features of the app to ensure that the user’s data accessed by the app is secure.

Figure 1: SDLC flow diagram (Image credits: Google images)

Figure 2: Workflow diagram for testing a Web app (Image credits: Google images)

Role of open source tools in optimising the performance of various Web applications

There are many considerations that software quality assurance engineers need to take into account and evaluate before giving a thumbs-up to any Web app. Since we are in an era of automation, a machine or system helps us do all our mundane manual activities. There are various open source tools that can be used to evaluate and optimise the performance of any Web application on the basis of the users’ requirements (and they let users know if improvements are required). Let’s look at how open source tools assist in optimising the performance of Web applications by first evaluating the apps and then removing the bugs discovered in the process.

1. An automation tool helps a tester in generating and executing different test cases and scenarios for the specific Web app under test.
2. A tester can even record various actions that need to be performed while validating any Web app in the form of code or script, and this can be executed while testing that scenario again during regression testing.
3. Developers of Web apps also need to perform unit testing, and this is done using different open source tools like Selenium, Watir, etc.
4. Open source tools like Selenium and AutoIt help in performing functional testing for any Web app by validating the features of different elements in the app.
5. Validation of the GUIs in different tabs or pages of a Web app needs to be done to check if these are visible in the required format, for which open source tools like AutoIt are apt.
6. Once different modules of the app are tested separately, they also need to be tested after integration; for this, integration or link testing for the complete app is done with different open source tools.
7. It’s even possible to fetch data from a specific database or data warehouse and perform validation on it using open source automation tools. This ensures that the data fetched by the application is what users need or asked for.
8. Every Web app developed needs to ensure its users are secure. It’s quite important to users that their data is secure and not accessible by anyone not authorised to do so. An open source tool like SOAPUI is good enough to evaluate the security parameters of any Web app.
9. Performance and load testing can also be performed using open source tools like JMeter, to ensure that the app does not crash under a heavy load and works as per the user’s expectations.
10. Detailed tracking and reporting of the test cases, whether these were passed or failed, as well as information about the bugs detected can also be retrieved using open source tools.

Top five open source tools for evaluating and optimising Web apps

Here are the best open source tools that are widely used to test and evaluate any Web application.

Selenium

Selenium is an open source software testing framework designed for Web apps. It facilitates in authoring tests without even learning a test scripting language (Selenium IDE) by providing a record/playback tool. Selenium also provides a test domain-specific language called Selenese, due to which we can write tests in different popular programming languages like C#, Java, Groovy, Peru, Python, PP, Ruby and Scala. The automated tests can then be run against most of the modern Web browsers. Selenium can be deployed on Windows, Linux and OS X platforms. It is open source software released under the Apache 2.0 licence.

Supported scripting languages: Java, C#, Ruby, Groovy, PEEL, Python, PHP and Scala

Features:
1. Provides a record/playback tool to automate test suites.
2. Identifies components of the app using the properties of various elements.
3. Comprises the Selenium IDE, the client API, Web driver, the grid and remote control.
4. Commands generated in the Selenium IDE Table mode, also known as Selenium commands, are simple type or click-type commands.
5. Capable of capturing test items or objects, both with or without the X Path values.
6. Synchronises the script with the mouse and keyboard related commands.
7. Selenium Grid dramatically speeds up functional testing of Web applications by leveraging the user’s existing computing infrastructure.
8. Allows different users to easily run multiple tests in parallel, on multiple machines or even in a heterogeneous environment.
9. Can be deployed on Windows, Linux and Macintosh platforms.

Figure 3: Components of Selenium

Watir

Watir (Web Application Testing in Ruby, pronounced ‘water’ ) is a Ruby based automation tool for automating Web browsers. Watir was developed by Bert Petticoated and Paul Rogers. It actually drives an application on the Web in a manner that’s similar to how users do. It clicks on a browser, fills the form data, presses buttons, etc. It also checks results such as when any text appears on a page. It is quite simple and flexible. Using the Ruby programming language, Watir can even make a connection to the database and read files (.text, .ls, .XML, etc). Users can also create their own functions and library for reusable code.

Supported scripting language: Ruby

Features:
1. Test scripts in Watir can be written using Ruby, and it consists of a Ruby library which helps to simulate users’ action in the browser.
2. Is able to use the full power of Ruby to read the data from Excel files and write the data to Excel files or XML files in test scripts.
3. Very popular among testers; hence, the community that backs it is growing.
4. Supports all Web apps, no matter what language these are developed in.
5. Supports multiple browsers and that too, on different platforms.
6. Powerful and easy to use, yet wonderfully lightweight.

SoapUI

SoapUI is the world’s most widely-used open source Web service testing application. It can test different Web services for service-oriented architectures (SOA) or representational state transfer (REST) APIs. It was developed by Liveware Software, which was later acquired by Smart Bear Software in 2011. SoapUI was initially released to Source Forge in September 2005. It is free software that is licensed under the terms of the European Union Public License (EU PL). It is developed entirely on the Java platform, and it uses Swing for the user interface. SoapUI is cross-platform and also supports Eclipse, IDEA and Net Beans. It can test SOAP and REST Web services along with JMS and AMF. SoapUI also provides extensive opportunities for scripting by using either Groovy or JavaScript (since Soap 3.0).

Supported scripting languages: Groovy Script, JavaScript

Features:
1. Functional testing
a. Allows all testers to write functional API tests in SoapUI.
b. Supports the drag-and-drop feature.
c. Also supports test debugging and allows data driven test development.
d. Allows advanced scripting (code can be customised depending on the scenario).

2. Security testing
a. Capable of performing a complete set of vulnerability scans.
b. Prevents SQL injection in order to secure the databases.
c. Scanning performed for cross site scripting.
d. Also performs boundary scans and fuzzing scans to avoid erratic behaviour of the services.

3. Load testing
a. Distributes the load tests across different load agents.
b. Simulates high volume and real-world load testing.
c. Advanced customised reporting to capture different performance parameters.
d. Allows end-to-end performance monitoring of the system.

4. Supported protocols/technologies
Supports most comprehensive protocols like SOAP, WSDL, AMF, HTTP, REST, JD and JMS.

5. SOAPUI integration
SoapUI can be easily integrated very well with popular tools like Maven, J Unit, Apache-Ant, etc.

Figure 4: Protocols supported by Soap

Sahi

Sahi is an automation and testing tool for Web apps, available in an open source and proprietary version. The open source version includes all the tools required for most testing purposes, and is popular because it can be modified according to one’s needs. Sahi Open Source is written using Java and JavaScript and has been hosted on Source Forge since October 2005. It has been released under an Apache License 2.0 and its latest version is 6.1 (published on November 5, 2014).
Sahi basically runs as a proxy server and the browser’s proxy settings are configured so that they point to Sahi’s proxy. Sahi then injects JavaScript event handlers into the Web pages, which allows it to record and then play back different events on the browser. Since Sahi uses the proxy to interact with different Web apps, it does not get affected by the browser on which that application is run.

Supported scripting language: Sahi Script

Features:
1. Can test Web applications running on IE, Chrome, Firefox, Safari, Opera and any modern browser.
2. The record and playback feature is available on all the browsers that it works on.
3. Generates output reports in HTML format whenever the script written is played back in order to test any action.
4. Can run a single test case or even suites of more than one test case at a time. It supports the batch-run process as well.
5. One can even play back more than one test script in parallel, at the same time, using Saki.

Apache JMeter

The Apache JMeter is open source software designed as a 100 per cent Java app to test functional behaviour and measure performance. It was originally designed for testing Web apps alone but has since expanded to other test functions as well. Apache JMeter can be used to test performance, both on static and dynamic resources, including dynamic Web applications.
It can also be used to simulate a heavy load on a single server, group of servers, network or even object—to test strength and to analyse the overall performance under different types of load.

Supported scripting languages: Groovy and Bean shell script

Features:
1. Can help in performing load testing as well as performance testing of the following different applications, servers and protocols:
a. Web – HTTP and HTTPS (Java, PHP, NodeJS, SPINET, etc)
b. Web services – SOAP/REST
c. FTP and TCP protocols
d. Database via JDBC
e. Message-oriented middle ware (MOM) via JMS
f. Native commands or shell scripts
g. Mail – SMTP(S), POP3(S) and IMAP(S)
h. LDAP and Java Objects
2. Consists of Test IDE which allows fast test plan building, recording (from browsers or native applications) and debugging.
3. Can run in command-line mode (non GUI/headless mode) to load tests from any Java compatible OS (Linux, Windows, etc).
4. Easily portable and generates a complete and dynamic HTML report.
5. Its multi-threading framework allows concurrent sampling by many threads, and even simultaneous sampling of different functions using separate thread groups.
6. Helps in caching and offline analysis or in replaying test results.