ICIT 2011 The 5th International Conference on Information Technology
Generation of Test Cases From Websites
User Sessions
Sanaa Alsmadi1, Izzat Alsmadi2, Mohammed Al-Kabi3
1-3
CIS Department, IT & CS Faculty, Yarmouk University
Irbid, Jordan
1
san.alsmadi@yahoo.com
2
ialsmadi@yu.edu.jo
3
mohammedk@yu.edu.jo
Abstract− The goal of software testing is to detect bugs in User sessions are important for many reasons. First, it
software projects using the least amount of available can help to customize users according to their
resources. This paper suggests utilizing user sessions for preferences. Second, providing information about
test cases generation and execution. There are many traffic of the Website during different times of the day
proposed methods to develop test cases, some of these are
and thirdly, detecting defects by examining errors
manual, and some are automatic. In this paper, we
proposed an automatic method for generation of test cases recorded on the Web logs [4].
based on user sessions, through converting usage data into The best representation of the most common
test cases. The main advantage of using session data in requirements is user behavior. This is when the user
testing is that it can be gathered from the application in visiting a Web application, records actions in a log file
business environments and represent user stories or and uses those actions later for testing. This would
scenarios. We used new link coverage verification criteria, result in a very effective and effortless way for testing
through Session Weight Reduction technique to reduce and ensure Web application quality.
less frequent test cases, while not affecting coverage Test case reduction removes unnecessary test
efficiency.
cases, which if it removed from the test suite, will not
affect the efficiency [5]. Test case prioritization is a key
Keywords− Software testing, user sessions, session’s concept of case testing and gives order to the test cases
reduction technique and test automation.
in the test suite. The purpose of this ordering is to
reduce the testing cost as much as possible [6].
I. INTRODUCTION
A new direction in Web application testing is
to use previously recorded user session data for testing. II. RELATED WORK
Converting usage data into test cases is known as user
session based testing [1], where a user session has a set In order to use user actions or sessions, they
of user actions started from entering a Web application have to be formally described or modeled. Several task
and terminated when the user leaves it. This data is oriented models are suggested to model the users’
stored as sequence of URLs, with their related field- tasks’ descriptions. Users actions can be described in
value pairs [4]. In [2] Alsmadi used the logs collected three levels; goals, tasks and actions. Actions maybe
from platform applications in order to generate the test directly related to the specific function, however, users
cases automatically from them. As a continuation to the may take other actions which are not motivated by
subject, we will try to use the same concept on Web tasks during interaction. User actions are often based
applications using Web logs. on a predefined list. Actions that are not listed maybe
User session data can also provide effective considered irrelevant to that specific test. An
partitioning or coverage, together with using these automated extracting process may not be able to
sessions as input data that can be transformed into test distinguish actions related to tasks from actions that are
cases [1]. The test cases generated from the user not.
sessions do not replace those developed by testers. For Alshahwan [4] proposed an approach to
better coverage, both alternatives should be considered. generate test cases from user sessions by following just
User session based testing of Web applications also independent paths, by converting user sessions data,
provides an effective partitioning or coverage. Testing and after that matching sessions to cases by taking into
can be conducted on these user sessions even with poor account two basic tasks: First adjusting invalid requests
requirements; where the requirements are unclear, and second, adjusting invalid sequences of requests.
incomplete, and there may be problems on it. Also The system interacted by a set of components dealing
miscommunication may take place between developers with each other.
and customers [3].
ICIT 2011 The 5th International Conference on Information Technology
Session Based Testing (SBT) was first and to avoid the execution of large amounts of user
formalized in 2000 by by Jonathan and James Bach [7]. sessions. The user sessions are divided according to
In SBT, a charter is made to describe the test goal. A their usage from user sessions into three clustering
session report logs specific information during session levels: heavily used, medium, and low. These
execution such as: charter, tester name, time started, clustering levels are to focus the testing process on
issues and bugs. We want to have a different logging most frequent usage from user sessions, so we schedule
format that can be used in test automation and that is test cases, according to some criteria in order to meet
independent on a certain application. Those two issues some of the performance goals; this technique is called
are not considered in SBT. Session Weight technique.
Several research projects are presented
regarding the usage of user sessions in web application We used these criteria that are based on the
for validation issues ([1], [8], [9] − [10]. Usually it is experimental results for S.Sampth et al. [6]. They
easier to gather users’ sessions from websites or proposed several new test prioritization strategies, and
applications than from regular applications. A typical examine whether these strategies can improve the rate
test case in web applications includes one or more web of fault detection and testing results. They showed that
page to be surfed in a certain sequence. User-session proposed Frequency-Based Prioritization Criteria often
based techniques can help with this problem by improve the rate of fault detection. According to these
transparently collecting user interactions (clients’ criteria, the test cases that cover most frequently
requests) in the form of URLs and name-value pairs, accessed sequence of pages are selected for execution
and then applying strategies to these to generate test before test cases that exercise less frequently accessed
cases [1]. It is also easy to extract information from sequences of pages. Table1 shows the frequency for
web sessions such as the link visited, the time, etc. each user session is computed automatically by our
tool.
III. GOALS AND APPROACHES
TABLE 1
There are two goals of using user sessions in Each Session and their Frequency
test automation. First, user sessions are used as a
method for test case prioritization. We want to be able,
automatically and without user intervention, to specify
the controls or the sequence of controls that should be
given more focus in testing. Information gathered from
user sessions is used to specify the weight of user
scenarios. The second goal in using user session is in
abstracting those sessions into information that can be
used as an input for generating test cases.
A. Data Collection and Preprocessing of User Sessions
The data is collected by the server side, and
the collected log files normally contain all the user The user sessions are sorted in descending order
sessions, which describe the links visited by the users. according to the link frequency. After that, the
Each logged request of the user session is changed into percentage of each link is computed relative to the total
an HTTP request that can be sent to a Web server. number of frequency links as shown in the following
formula:
Frequency of the link
Link Percentage =
Total number of links frequencies
After that, the user sessions are clustered (grouped)
according to their usage, into three clustering levels;
heavy, medium, and low. These clustering levels are
selected according to this algorithm.
Note: In this paper the numbers in the function are
Fig. 1 Log File Sample from Yarmouk University empirically selected.
A set of user sessions are collected from the
Web sites that represent a sequential application usage
extracted from Web logs. The testing input data is
preprocessed in order to prepare data for generation,
2
ICIT 2011 The 5th International Conference on Information Technology
Link: allows you to like non-Website URLs
Fig. 2 Pseudo Code Function for Sessions Weighting
If (Percentage > 0.004) then
B. Automatic Generation of Test Cases User session Weight is High
The test cases are generated automatically, If (Percentage 0.0001)
after preprocessing the user sessions, through the
transformation of user sessions into test cases. then
User session Weight is Medium
C. Automatic Execution of Test Cases
Execution test cases run the links If (Percentage . 2006.
areas explored were using user sessions to cluster and [11]. I.Alsmadi, and K.Magel, GUI Path Oriented Test Generation
prioritize test cases, and in test case execution and Algorithms, in Proceeding of IASTED (569) Human Computer
verification. Interaction. 2007.
We compare between the number of generated
[12]. Y.Wei, C.Lin, F.Ren, E.Dutkiewicz, and R.Raad, Session Based
and executed test cases, after the Session Weight Differentiated Quality of Service Admission Control for Web Servers,
Reduction technique is applied, within the Yarmouk ICCNMC2003. 2003.
University Web log file, it is found that 13 high
frequent test cases from the 31,000 test cases cover
30% from total number of test cases frequency. So the
Session Weights Reduction technique guides us to take
into account most frequent test cases, and discard less
frequent test cases.
In the future, we would like to compare the
test effectiveness of this technique with other
techniques, and design an effective test suite from a
given set of user sessions, by grouping together user
equivalent behaviors into equivalence classes, and
defining test cases for covering each equivalence class.
REFERENCES
[1] S.Elbaum, G.Rothermel, S.Karre, and M.Fisher, Leveraging
User-Session Data to Support Web Application Testing, Transactions
on Software Engineering, pages: 187–202, IEEE May 2005.
[2] I.Alsmadi, The Utilization of User Sessions in Testing,
International Conference on Computer and Information Science,
pages: 581 – 585, IEEE 2008.
[3] J.Sant, A.Souter, and L.Greenwald, An Exploration of Statistical
Models for Automated Test cases Generation, in proceedings of the
Third International Workshop on Dynamic Analysis, pages: 1–7,
May 2005.
[4] N.Alshahwan, Automated Regression Testing of Web
Applications,
September 2005.
[5] A.Mansoor, S.Zulfikar, and A.Bhutto, Analytical Survey on
Automated Software Test Data Evaluation, Institute of Science and
Technologies, International Conference, pages: 580 - 585, June 2010.
4