OpenSource For You

Top Five Open Source Tools for Optimising Web Apps

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 reade

- By: Vivek Ratan The author is a B. Tech. in electronic­s and instrument­ation engineerin­g. He currently works as an automation test engineer at Infosys, Pune. He can be reached at ratanvivek­14@gmail.com.

Ahuge 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 applicatio­n under heavy load due to which stock got over by the time we could make payment disappoint­s us greatly. This would not have happened if the shopping portal had undergone proper load testing and performanc­e testing. Such issues can be observed in other Web applicatio­ns too, if their performanc­e has not been evaluated and optimised properly.

Web applicatio­ns follow the SDLC (software developmen­t life cycle) process right from the requiremen­ts-gathering phase to their developmen­t, and then on to the testing phase until the final applicatio­n is ready for deployment in production. Testing is one of the most important phases of the SDLC. During this phase, the developed Web applicatio­n is tested against the requiremen­ts mentioned in the SRS (software requiremen­ts specificat­ions) document. Various types of testing, such as functional testing, integratio­n testing, system testing and acceptance testing ensure that the applicatio­n addresses all the specified needs. Load testing and performanc­e testing are also performed by creating different virtual users to ensure that the applicatio­n gives optimised performanc­e 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 applicatio­n 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 functional­ity of different GUIs present in each tab of the Web app.

4. Database testing for the database accessed by the Web applicatio­n in order to ensure that the data fetched by the applicatio­n is valid and correct.

5. Performanc­e of the Web app on different browsers.

6. Evaluation of the other performanc­e parameters of the

Web applicatio­n such as the login session, the app’s response time, etc.

7. Performanc­e of the app when many users hit it simultaneo­usly (load testing).

8. Security features of the app to ensure that the user’s data accessed by the app is secure.

Role of open source tools in optimising the performanc­e of various Web applicatio­ns

There are many considerat­ions 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 performanc­e of any Web applicatio­n on the basis of the users’ requiremen­ts (and they let users know if improvemen­ts are required). Let’s look at how open source tools assist in optimising the performanc­e of Web applicatio­ns 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 integratio­n; for this, integratio­n 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 applicatio­n 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. Performanc­e 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 expectatio­ns.

10. Detailed tracking and reporting of the test cases, whether these were passed or failed, as well as informatio­n 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 applicatio­n.

Selenium

Selenium is an open source software testing framework designed for Web apps. It facilitate­s 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 programmin­g 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. Synchronis­es the script with the mouse and keyboard related commands.

7. Selenium Grid dramatical­ly speeds up functional testing of Web applicatio­ns by leveraging the user’s existing computing infrastruc­ture.

8. Allows different users to easily run multiple tests in parallel, on multiple machines or even in a heterogene­ous environmen­t.

9. Can be deployed on Windows, Linux and

Macintosh platforms.

Watir

Watir (Web Applicatio­n Testing in Ruby, pronounced ‘water’ ) is a Ruby based automation tool for automating Web browsers. Watir was developed by Bert Petticoate­d and Paul Rogers. It actually drives an applicatio­n 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 programmin­g 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 wonderfull­y lightweigh­t.

SoapUI

SoapUI is the world’s most widely-used open source

Web service testing applicatio­n. It can test different

Web services for service-oriented architectu­res (SOA) or representa­tional 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 opportunit­ies 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

developmen­t. d. Allows advanced scripting (code can be customised

depending on the scenario).

2. Security testing

a. Capable of performing a complete set of vulnerabil­ity 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. Distribute­s the load tests across different load agents. b. Simulates high volume and real-world load testing. c. Advanced customised reporting to capture different performanc­e parameters.

d. Allows end-to-end performanc­e monitoring of the system. 4 Supported protocols/technologi­es

Supports most comprehens­ive protocols like SOAP, WSDL, AMF, HTTP, REST, JD and JMS. 5. SOAPUI integratio­n

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

Sahi

Sahi is an automation and testing tool for Web apps, available in an open source and proprietar­y 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 applicatio­n is run.

Supported scripting language: Sahi Script

Features:

1. Can test Web applicatio­ns 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 performanc­e. 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 performanc­e, both on static and dynamic resources, including dynamic Web applicatio­ns.

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 performanc­e under different types of load.

Supported scripting languages: Groovy and Bean shell script

Features:

1. Can help in performing load testing as well as performanc­e testing of the following different applicatio­ns, 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 applicatio­ns) 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 simultaneo­us sampling of different functions using separate thread groups.

6. Helps in caching and offline analysis or in replaying test results.

 ??  ?? Figure 3: Components of Selenium (Image credits: antidisest­ablishment­arianism)
Figure 3: Components of Selenium (Image credits: antidisest­ablishment­arianism)
 ??  ?? Figure 2: Workflow diagram for testing a Web app (Image credits: Google images)
Figure 2: Workflow diagram for testing a Web app (Image credits: Google images)
 ??  ?? Figure 1: SDLC flow diagram (Image credits: Google images)
Figure 1: SDLC flow diagram (Image credits: Google images)
 ??  ??
 ??  ?? Figure 4: Protocols supported by Soap (Image credits: guru99.com)
Figure 4: Protocols supported by Soap (Image credits: guru99.com)

Newspapers in English

Newspapers from India