Научная статья на тему 'E-Commerce testing framework'

E-Commerce testing framework Текст научной статьи по специальности «Компьютерные и информационные науки»

CC BY
230
36
i Надоели баннеры? Вы всегда можете отключить рекламу.
Ключевые слова
SOFTWARE / TESTING / AUTOMATION / FRAMEWORK / E-COMMERCE

Аннотация научной статьи по компьютерным и информационным наукам, автор научной работы — Lefterov Denislav

This article presents the development of an automation-based testing framework, whichsupports and helps to implement easily new tests related to Web platforms analogous to Ecommerce applications. With the advantages of Page Object Pattern and the using of the following technologies: Java programing language, JUnit and TestNG extended libraries. The created scripts represent automated acceptance, functional and non-functional tests in which the Page Object pattern is used to separate the tests into individual fragments and subsequently to call them in a different order according to the test requirements and business logic. Tests can be numerous, but the elements visualized in a given functionality are similar in order to reuse the key iterations, software testers need to separate the programming logic of individual modules. This is further described in the following article.

i Надоели баннеры? Вы всегда можете отключить рекламу.
iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.
i Надоели баннеры? Вы всегда можете отключить рекламу.

Текст научной работы на тему «E-Commerce testing framework»

Научни трудове на Съюза на учените в България - Пловдив. Серия В. Техника и технологии. Том XVII, ISSN 1311 -9419 (Print); ISSN 2534-9384 (Online), 2019. Scientific Works of the Union of Scientists in Bulgaria - Plovdiv. Series C. Technics and Technologies. Vol. XVII., ISSN 1311 -9419 (Print); ISSN 2534-9384 (Online), 2019

СОФТУЕРНА ТЕСТОВА РАМКА ЗА ЕЛЕКТРОННИ МАГАЗИНИ

Денислав Лефтеров Пловдивски Университет „Паисий Хилендарски"

E-COMMERCE TESTINGFRAMEWORK Denislav Fefteeov Plovdiv University "Paisii Hilendarski"

Abstract

This article presents the development of an automation-based testing framework, which supports and helps to implement easily new tests related to Web platforms analogous to Ecommerce applications. With the advantages of Page Object Pattern and the using of the following technologies: Java programing language, JUnit and TestNG extended libraries. The created scripts represent automated acceptance, functional and non-functional tests in which the Page Object pattern is used to separate the tests into individual fragments and subsequently to call them in a different order according to the test requirements and business logic. Tests can be numerous, but the elements visualized in a given functionality are similar in order to reuse the key iterations, software testers need to separate the programming logic of individual modules. This is further described in the following article.

Key words: software, testing, automation, framework, e-commerce

Introduction

In the past few decades, software testing has evolved in terms of both the tools used to perform different activities and the mindset of the people using those tools. There used to be only a handful of tools used in software testing, but now having a plethora of tools to choose, from proprietary to open source. The work of the practical development is done in the following plan: validating an exemplary website oriented to E-commerce environment and analyzes the way continuous software testing could involve. The system incorporates a plurality of graphical components that can provide information on whether automated tests meet the requirements and easily new tests can be developed from the previous test logic. An automation testing framework is described in the following way: hierarchical directory that encapsulates shared resources, such as a dynamic shared library, helpers, conditional strings, stored files, header data, and reference documentation in a single grouped package [6]. Framework is a wrapper around complex internal architecture which makes end user interacts with the system easily. Test Automation Framework is an application-independent solution that deals with all possible actions and verifications that can be performed on a single object. Therefore, the code for the same object can be used and reused across different applications - this is further described in the Diagram 1 [4].

Diagram 1

Challenges in the E-Commerce testing approach:

•End to end testing techniques and test management for the whole E-Commerce transformation applications;

• Compliance with the security guidelines to safeguard customer data and identity of the whole process, GDPR principles and guidelines;

• Compliance with accessibility standards to support multilingual markets and business regions;

• Scalability and reliability of the E-Commerce functional API's;

•Performance endurance for supporting almost 100% of the customer's needs.

Problem area

Nowadays software testing technologies provide a lot of testing efforts and solutions, but mainly they are concentrated to present the idea of general answer to the issue, and they are not specified with the current requirements of the particular application. So, of these conclusions we have to say that there is a need for providing an adaptive solution for proposing a set of testing frameworks oriented to the current needs for applications of this nature, namely E-Commerce oriented platforms [5].

The implementation of the validation Services - these services includes end to end testing of the functionality, integration, security, performance and extensions of the solution. The key aspects are listed below as follows:

• Main Pages/Re-Direction/Links Testing;

• Products Categories, Details and Search option Testing;

• Content Detail and Management Testing;

• Cross Sell and Up Sell Philosophy Testing;

• Order Management Based Testing;

• Payments Testing;

• Analytics, Reviews & Ratings and User Profile Testing;

• Promotions/Deals/Ads Testing;

• Social Media Integration and SEO Testing;

• Browser/Device Compatibility Testing;

• Integration Testing;

• Globalization Testing.

Each one of given above should be separately developed as a test scenarios module oriented. The Diagram 2 shows the exact structure of E-Commerce framework.

Diagram 2

This is a designed test automation framework based on Selenium Web Driver and TestNG and extended for current purpose. It can be used on all Web applications related to E-Commerce structure. The framework designed in this paper includes the following components listed below:

• Object Pattern Repository;

• Logger;

• Test Step;

• Data Provider;

• Asserter;

• Reporting Mechanism.

Object Pattern Repository

Selenium Web Driver supports various types of locators to locate the web page elements. Web page elements can be located by its ID, Link Text, Xpath or CSS and etc. locators. Object repository stores all the locators of web page elements [1]. This will simplify the task of maintaining and repairing the test cases. For example previous version of Web application contains 'Log-in' button. In next version 'Login' button changed to 'Login Here' or 'Login Now', so it is required to change the all the test cases which contains the 'Login' button. To avoid such kind of problems, there is an implementation of object repository which contains the ID, Link Text, Xpath or CSS for all web page elements with the advantages of Page Object Pattern model.

Whenever the QA specialist writes the test case, he will use the information to locate the web page element. This will reduce the maintenance cost of test cases/scenarios. Whenever a change occurs in the Web application elements, specialist will need to make changes only in the object repository and after that a chain conversion will be made automatically in every aspect and area of the software. [3]. Diagram 3 displays the approach from Class perspective of the Login functionality.

TestAutom ation

+ options + dri\er + client

tcurrentE lenient

+getO +find() +type(}

+clickO

+ end() -buildDriverQ

Dasl" boa rdPage

+ isAt() + addPost(}

LogiriPage

+ logln()

+withPasswoiid(} + as() + open(}

Login Test

Diagram 3

Logger

When a test is run there is always a chance that this approach could fail. In this case I have extended the main solution of exception handling and define a custom one. In this way, is ensured the approach in case of a potential failure that will have the necessary information as well as the exact location of the failure. There are many types of loggers. Here are some of them:

• Console Logger - writes log only in the console terminal

• TestNG Logger - adds info to TestNG log and description was stored of the

failure

• Log4J Logger - writes log in log4J log (can be configured log4J basically)

Step utensil

This file comprises the common functionality of Web application like login, logout, choose example product, buying product, using payment methods, completing order. In test suite QA specialist needs to login to Web platform to test internal functionality of application, choose different type of products then complete the order purchase using a payment method and after that log out after completion of the whole process. To avoid this kind of repetition, there were these main functionalities added. Each action is indicated and implemented in the step path.

A new function is developed, which will take the screenshot for failure test cases. Using this function tester can easily capture the exact screen when the error occurs. This will also help the developer to analyze their failure. After the execution of all test suites, screenshots for failure test cases are stored in directory according to date wise folder [7].

Steps to generate screenshot from failing test cases/scenarios:

1. Create directory where you store the screenshot for failure test case.

2. Capture the result from failed test case, detects the exact point of failure.

3. Screenshot custom method is connected with logger and listens for any action that can

occur.

4. Set the date and time for the screenshot Image file as title.

5. Store the image file in the defined directory.

Data Provider

In most of the Web applications, end user needs to enter given information for e.g. Mail login requires credentials to login. Such kinds of inputs are stored in data provider stub. Instead of entering same information in the application, tester may access dynamic functions from this data provided information.

Asserter

Assertions are used to validate the message received by a Test Step during execution, usually by comparing parts of the message (or the entire message) to some expected value. Any number of assertions can be added to a sampler test step, each validating some different aspect or content of the response. After a sampler test step executes, all its assertions are applied to the received response and if any of them fail the test step is marked as failed in the test case view and a corresponding FAILED entry is shown in the test execution log [8].

Implementation of IAsserrter interface in the current framework:

• exception - for throwing different kind of exceptions

• silent - for avoid adding throws Exception in methods but you can throw it (e.g. using assertTrueIs(false)) or hide and just add message in logger

• areEqualing - for comparing different object values

• contains - check is actual containing expected string

• matches - check is actual string matches to regExpressions

Custom reporting mechanism

Selenium Web Driver doesn't support built in functionality to generate reports. Here is developed a custom method to generate test reports. TestNG generates the report in HTML format, which is complex to understand. Some organizations want specific format of reporting by its requirements. So, there is need to customize the default report according to organization wishes. In this situation we extend the main method and cover all the fields which are responsible for the statistical report. Everything is portable through csv files and can be easily configured on multiple platforms [2].

Email customized report

After customizing the test report, it needs to be sent to respective authority. Mail.class was developed for sending the mail to a specific expert, client or someone else. Mail.class file support multiple protocols like SMTP, POP3. After each test suite there is a developed sendreport() method to send the test report [7].

After use of implemented automation E-Commerce testing framework, the regression testing efficiency is improved. QA specialists can write test cases twice faster than main approach. This reduces the human resource required to test the Web platform. The maintenance cost of test cases is also decreased due to global centralized repository. As the version of the system changes, you need to refactor only object repository pattern file for newly added elements and locators. Sometimes test cases are failed due to synchronization issues from Driver Controller and this is not a result from Web application defects. The proposed framework reduces the error/issue rate of failing test cases due to synchronization problems. Ultimately passing rate is increased. This shows the accuracy of the framework over traditional approach of testing. There was an execution test suite of 200 test cases on E-Commerce Web application. After the whole automation was run, we got the following results displayed in Table 1 terms of overall pass rate, failure rate, execution time and etc. Pass rate shows that test cases give the exact result as manual test cases before the

automation [7]. Sometimes the Web application works correctly as expected, but test cases fail as result to synchronization or parallel conflicts in the starting approach (set up the prerequisites). The proposed framework synchronizes the test cases properly, so failure rate is reduced than traditional approach with the extended custom methods and available open source libraries.

Table 1

Framework Overall pass rate (%) Overall failure rate (%) No. of test cases per day Execution time (hrs.) Maintenance Cost

E-Commerce Proposed Framework 89.9 8.95 48 8.6 Medium to Low

Traditional Framework 68.5 22.5 22 10.2 High

End to end testing covered in the E-Commerce flow chart diagram

Diagram 4

Conclusion

In this paper I have proposed new automation testing framework approach to test ECommerce based Web applications configured and extended on Selenium Web Driver. The proposed automation framework reduces the required time to write test cases and increases pass percentage rate of them by covering all the main steps in applications of this nature. It also reduces vulnerable workload of testers. By using this framework specialists can implement the framework over any application oriented to E-commerce by configuring the main methods by their needs. They can generate customized test reports and also analyze the failures using screenshots of failed test cases and manage to trace the issue precisely. QA specialists can maintain all the data from centralized stored place. This framework is very useful for dynamically changing Web applications, which implements new features very often. Automation test scripts are easy to handle

and are understandable. In this way automation framework helps the organizations to test ECommerce Web applications efficiently.

References

1.Selenium all Core Documentation [Online]. https://www.seleniumhq.org (Accessed on 24 September 2018).

2.TestNG Documentation [Online]. https://www.testng.org (Accessed on 25 September

2018).

iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.

3.Z. Wanadan, J. Ninkang, Z. Xubo. Design And Implementation Of A Web Application Automation Testing Framework; Ninth International Conference On Hybrid Intelligent Systems, 2009.

4. Rigzin Angmo,Monika Sharma. Selenium Tool:A Web based Automation testing Framework. International Journal of Emerging Technologies in Computational and Applied Science 2014.

5.Sherry Singla, Harpreet Kaur. Selenium Keyword Driven Automation testing Framework, International Journal of Advance Research in Computer Science and software Engineering, VOL.4,Issue 6, 2014.

6.AndrzaM, Giesel A. etl. Extension of Selenium RC Tool to Perform Automated Testing with Databases in Web Applications; Automation of Software Test (AST), 2013 8th International Workshop, 2013.125-131.

7.Analysis and Design of Selenium Web Driver Automation Testing Framework, S. Gojare, R. Joshi, D. Gaigaware, Procedia Computer Science 50 (2015) 341 - 346, doi: 10.1016/j. procs. 2015.04.038.

8.SoapUI - Documentation [Online] Getting started with Assertions. https://www.soapui.org (Accessed on 10 October 2018).

For contacts:

UNIVERSITY OF PLOVDIV PAISII HILENDARSKI, 24 TZAR ASEN, 4000 PLOVDIV Denislav Lefterov, PhD student, Faculty of Mathematics and Informatics E-mail: denislav.lefterov@uni-plovdiv.bg

i Надоели баннеры? Вы всегда можете отключить рекламу.