Final Project Report PDF
Final Project Report PDF
Functional Testing
By
GAURAV KHURANA
2011HZ13006
November, 2013
ii
By
GAURAV KHURANA
2011HZ13006
November, 2013
iii
iv
ABSTRACT
ACKNOWLEDGEMENT
This project would not have been possible without the support of many people. I would like to
acknowledge and extend my heartfelt gratitude to the following persons who have made the
completion of this project possible.
My Supervisor, Rakesh Biswal, for his full support and guidance throughout this project.
My Manager, Mr. Devaraj Dey for encouraging and supporting me to pursue the project
Prof. Prasanna Chennupati from BITS Hyderabad, for giving the feedback at various stages of the
project which acted as a motivation for working on the project
My testing team members who have helped me during various phases of the project.
Last but not the least, I would like to express my love and gratitude to my beloved family, for their
understanding & motivation, through the duration of this project.
vii
LIST OF FIGURES
Figure 1 : Technical Architecture of Atlys ........................................................................................... 2
Figure 2 : Current Mode of Operation .................................................................................................. 3
Figure 3 : API Trends ........................................................................................................................... 8
Figure 4 : API acting as Interface ......................................................................................................... 9
Figure 5 : XML APIs .......................................................................................................................... 10
Figure 6 : Execution from Backend .................................................................................................... 11
Figure 7 : Classification of Data ......................................................................................................... 14
Figure 8 : Overall flow of Tool .......................................................................................................... 16
Figure 10 : Input Path ......................................................................................................................... 21
Figure 11 : Base Form ........................................................................................................................ 22
Figure 12 : Detailed Level Attribute Values ...................................................................................... 22
Figure 13 : Final form ......................................................................................................................... 23
Figure 14 : Model for Testing............................................................................................................. 24
LIST OF TABLES
Table 1 : Naming convention ............................................................................................................. 21
Table 2 : Statistics before tool implementation .................................................................................. 25
Table 3 : Statistics after tool implementation ..................................................................................... 25
ix
Table of Contents
Ch No. Title Page No
i) Certificate iii
ii) Abstract iv
iii) Acknowledgements vi
iv) List of Abbreviations vii
v) List of Figures viii
vi) List of Tables viii
Chapter 1 Introduction ......................................................................................................................... 1
1.1 Organizational Background .................................................................................................... 1
1.2 About the Product ................................................................................................................... 1
1.3 Architecture ............................................................................................................................ 2
Chapter 2 Project Overview ................................................................................................................ 2
2.1 Current Mode of Operation .................................................................................................... 2
2.2 Problem with the existing solution ......................................................................................... 4
2.3 Suggested solution .................................................................................................................. 4
2.4 Objectives ............................................................................................................................... 4
2.5 Expected features .................................................................................................................... 4
2.5.1 User friendly design............................................................................................................. 4
2.5.2 Cost Reduction .................................................................................................................... 5
2.5.3 Training ............................................................................................................................... 5
2.6 Scope of Work ........................................................................................................................ 5
Chapter 3 Motivation for Tool............................................................................................................. 6
3.1 Automated Testing ................................................................................................................. 6
3.2 When we should do the Automation ...................................................................................... 6
3.3 Automation is suitable for following types of Testing ........................................................... 6
3.4 Benefits of Automation .......................................................................................................... 7
3.5 Areas where Automation can be attempted first .................................................................... 7
3.6 Disadvantages of Automation ................................................................................................ 7
3.7 Trends in industry ................................................................................................................... 8
Chapter 4 XML API ............................................................................................................................. 9
4.1 What is an API ? ..................................................................................................................... 9
4.2 What is XML? ........................................................................................................................ 9
4.3 Working of XML API .......................................................................................................... 10
4.3.1 Extension Layer ................................................................................................................. 10
4.3.2 Integration layer ................................................................................................................. 10
4.3.3 Business Layer ................................................................................................................... 11
4.4 Why XML APIs.................................................................................................................... 11
4.5 Testing APIs ......................................................................................................................... 11
Chapter 5 Design for Tool .................................................................................................................. 12
x
Chapter 1 Introduction
1.1 Organizational Background
NetCracker Technology is the proven partner for communications service providers and cable
operators offering comprehensive, end-to-end solutions and delivery capabilities to optimize their
enterprise. With its global reach, leading-edge technology, and unbroken track record of successful
implementations, NetCracker helps eliminate operational and business silos and delivers real-time
experience in an on-demand world.
In 2008, following 15 years of independent and profitable growth, NetCracker Technology was
acquired by NEC Corporation. The acquisition was followed by NetCracker’s large-scale business
expansion whereby NEC consolidated its services business under NetCracker. The assets
encompassed innovative applications and service platforms, including customer and service
management, network management. In May 2012, NetCracker completed the acquisition of the
Convergys Information Management (IM) business. The Convergys IM business, with its long
history of innovative BSS solutions, successful implementations, and managed services,
strengthened the expansion into the BSS space.
NetCracker’s BSS/OSS solutions and services have been implemented and used successfully by
hundreds of customers worldwide, including Fortune 1000 companies and the U.S. government
1.3 Architecture
This is shown in the figure 2 how the browser is being used to fire the APIs.
3
2.4 Objectives
● Reduce the number of Person-hours required to complete testing thus saving a lot of effort
for the project
● Cover Scenarios which are not possible to be done manually covering Black Box testing
techniques.
This project should provide the user with the ease of avoiding the hassle of querying database every
time using three software’s simultaneously. This will save a lot of effort as the user interface that is
being designed is very easy considering the factor that anyone in the team can use it.
5
Reduce the number of Person-hours required to complete testing thus saving a lot of effort for the
project APIs that are run manually as of now. Preparing an API which is having attributes as many
as forty in numbers takes a lot of time. It is done in every release. Normally it takes more than half
an hour in preparation of the API itself searching all the data from database. For new resources in
the team it takes even more time. A person should even be knowledgeable enough to remember all
the tables from which data needs to be taken for those APIs. As sometimes even that is not there in
the test case. So it takes time to go through the table’s link and check the various different attributes
before finalizing the values for the attributes. There are chances that a tester needs to refer to more
than one table for getting the values.
So making the above process automated will save a lot of time as it would be a one-time effort
creating an automated script for each API. That script can be used forever for the API with minimal
interaction with user until the API gets modified.
2.5.3 Training
The solution should be designed in such a way that end user can create automation scripts without
the knowledge of any scripting language.
User should be able to use the software with minimal training.
"Automated Testing" involves automating the manual testing process currently in use. This
section will be limited to API automated testing
Automation refers to the use of such tools which can reduce the need of manual or human
involvement in redundant, time taking tasks. API Automation process includes – Creation of test
scripts, which have been derived from raw APIs having some default values
A test environment in *nix operating system with a database is needed such that test scripts are
able to be repeated each time there is need to run the APIs
Automation is the basic motivation for creation of the tool and due to listed discussions.[4]
Load Testing – to determine the points at which the capacity and performance of the
system degrades to the situation that hardware or software upgrades would be required.
In this project, our focus is on first three points, however we will cover last two points also indirectly
with some manual intervention
Reliable: Tests perform precisely the same operations with different data each time they are run,
thereby eliminating human error
Repeatable: We can test how the software reacts under repeated execution of the same
operations.
Efficient: Tests run in a reasonable amount of time.
Sufficient: Tests verify all the requirements of the software being tested.
Programmable: We can program complex tests that bring out hidden information
from the application.
Comprehensive: We can build a suite of tests that covers every feature in our application.
Reusable: We can reuse tests on different versions of an application, even if the user interfaces
changes.
Better Quality Software: Because we can run more tests in less time with fewer
resources
Fast: Automated Tools run tests significantly faster than human users.
Economical: As the number of resources for regression test are reduced.
Though this automation has many advantages, it has its own disadvantages too. Some of the
disadvantages are:
8
Test maintenance is needed which is cost consuming if API is getting changed frequently.
People with the knowledge of scripting languages are required to debug in case of errors.
Problems if got while creation of scripts will remain forever if not checked.
Figure 3 clearly shows how the importance of API calls has been increased in industry . Similar trend
has been observed for telecommunication service providers. Since at the back end there are many
systems that works together so API correct functioning is important not only for better functioning of
the system but for collaborations with external partners.
Middleware
interface
Extension Layer
Integration Layer
Business Layer
Below figure 7 shows the execution of API at Unix prompt in standalone mode
This is shown in Figure 2 where we paste the API is browser session and submits it for
processing.
12
We have divided the tool into four different components. The first one is the parsing component i.e.
the XML parser, then we have the Dynamic Controls Generator, after this come the Automation
Template in Perl, and the final one is the Script Generator. Apart from discussion on the components
design talks about the classification of input which is the core thing of the tool on the basis of which
input data for the tool is getting decided. Figure 8 shows the overall flow of the tool.
XPathDocument:- Is appropriate when the XML file to parse is deeply nested or has a
complex structure.
Dataset :It has a very relational database feel, provides medium level of abstraction
After analyzing all the above different ways for parsing the API, It was concluded that
XmlTextReader should be used because of the following reasons.
We have used the read function of XmlTextReader to first read the elements and then used the
HasAttributes function to check if the element has attributes as we are interested in only those
elements which have some values, others are just ignored. Values for all three namely elements,
attributes and corresponding values are being stored as soon as they are retrieved.
MoveToNextAttribute function is being used for moving to the next element.
Using the above methods, we should be able to get the required things from the API, from where we
can proceed to our next step after parsing.
13
We have used the following controls in our forms which are designed to have interaction with the
user[7]
5.2.1 Labels: - A Label control is used as a display medium for text on Forms. Label control does
not participate in user input or capture mouse or keyboard events.
We have used it extensively in the tool to provide necessary information to the users mostly near the
buttons and textboxes.
5.2.2 Combo Boxes: - Combo Box is a combination Textbox with a drop-down. Its drop-down list
presents preset choices. Only one list item is displayed at one time in a Combo Box and other
available items are loaded in a drop down list. The user can type anything into the Combo Box, or
select something from the list.
We have tried to use combo boxes at most of the places so that user has minimum opportunity to
type and try to cover maximum choices in the pre-defined list. We have restricted the user to type
user defined choices to avoid unpredictable behavior.
5.2.3 Textbox: - It lets user’s type letters and enters data. Many events and properties are available
on the Textbox control. We have used the properties to adjust the textboxes covering all the different
requirements of sizes as per the data types of the attributes.
We have given preference to combo boxes at most of the places and where we are not able to
accommodate combo boxes, we have used text boxes to get customized data from the user.
5.2.4 Buttons: - It accepts click events and performs other actions in the user interface. This control
provides a way to accept input and invoke logic based on that input. Button controls provide a way
for users to commit a command or perform an action, like submitting or resetting a form.
We have used it to allow users to proceed to next forms, generate the final automation script, and
add new objects into existing form
It should create a script which should have edit permission so that if the user wants any modification
in the input file
14
It will show the user the final output path of the script generated
5.5.1 Integer
Fixed Length
Maximum Integer Length
i. Variable Length
ii. Minimum Integer Value
iii. Maximum Integer Value
5.5.2 String
Fixed Length
Variable Length
Alphanumeric-Fix
Alphanumeric-Variable
Numbers-Fix
15
Numbers-Var
SpecialCharacters-Fix
SpecialCharacters-Var
All the above have one sub-category that is “Maximum String Length” which will be suffice for
covering most of the scenario.
5.5.3 Float
All the above have two further below sub-categories that are
Minimum Float Value
Maximum Float Value
5.5.4 Boolean
Since Boolean can always have two values. But those values are not fixed. Those values vary as
per the implementer of the API and sometimes as per the client’s requirements. So it has been
given as a choice to the end user to put any two values here.
5.5.5 Date
Date is a non-trivial type of attribute. It has several representations and the way they are being
used in API. So we have decided to take the below one’s which are specific to our project. Since
there is no specific standard for dates anywhere. We have to list down few only. However with
some modification some new ones can be added
YYYY-MM-DD
DD-MM-YYYY
YYYYMM
MMYYYY
YYYYMMDD
DDMMYYYY
DD-MMM-YYYY
5.5.6 Query
This is the most important attribute among all, as this is the place where user can take out data
from the database. This will be random data. This part of the tool will cover the different valid
values retrieved from database. User is advised to give generic query so maximum data could be
checked. User may take advantage of this by providing those query which are not specific to
retrieve data from some customer database but to form patterns using the dual table.
16
There are chances that we might have missed something in the classification above. So this data
type is defined providing user the flexibility to define customized values. User is given the
choice to fill up custom values. User is allowed to give maximum 7 different values.
Chapter 6 Implementation
Raw data that is being received is classified into elements, attributes and values of those attributes.
We have used three different arrays to store the three types parallel at same indices all the three
arrays
This class contains the load function which contains the logic of XML parsing, and is being called at
the start of execution of the Tool.
6.2.1 Base Form : This is the first form which will be shown to the user. It will be having all the
elements and attributes from the API provided as input and will be having corresponding combo
boxes and textboxes to allow user to take actions
Next_Click :- Clicking on the “Next” button on “Base Form” will call this function which will now
parse the controls on the form and stores the values selected by the user. It will show the further
selection combo boxes which has detailed information regarding the values already selected after the
initialization of the form.
Proceed_Click :- After the user has selected the detailed choices too, he/she may press the
“Proceed” button which will take the user to a new form.
This form is generated on the detailed level selection by the user on the first form. It will allow user
to provide values in various form. This form is different from the first as it is having information at
the lowest level and may have textboxes enabled , disabled based on the last inputs. Some of the
textboxes will be disabled here as user might have selected.
18
Generate_Script_Click :- This is where the tools functionality comes to end. As this button will
generate final script for the input API. This script would be in Perl and can be run in Linux
environment.
ValueSelelected :- This function is written to check which are the values selected by the user. As we
need this functionality required by multiple forms. This one is written in a generic way.
19
Below Steps define the standards and practices which should be adopted for
Automation Tool.
5. Now fill the final details at the detail level & click Generate Script
9. Output file will be generated in the same path. Make sure your user id has write permission
in the directory
20
7.5 Compatibility
Attributes values are named combining the names of elements and attributes so that end user can
differentiate in case there are duplicate attributes for different elements
For example
The below API is for swapping price plan (services) for a subscriber.
<envelope>
<body>
<inputSwapPlan >
<sourceSvc svcName =”Service 300 Minutes”>
<targetSvc svcName = “Service 600 Minutes”>
</inputSwapPlan>
21
</body>
</envelope>
So if we get such API, we have same Attribute name (svcName) which is common for two
elements. So in this case, to facilitate the user we are providing the name like below, so it’s easy
for end user to understand which attribute belong to which element
1) sourceSvc.svcName
2) targetSvc.svcName
The following Table 1 lists recommended conventions for various controls which are
being used.
The images shown below Figure 10-13 depicts the execution of tool
8.1 Testing
As the title of the Dissertation says this tool is for Functional testing, we have made in such a
way that to do that in an exhaustive way.
Functional testing is a quality assurance (QA) process and a type of black box testing that bases
its test cases on the specifications of the software component under test. Functions are tested by
feeding them input and examining the output, and internal program structure is rarely
considered. Functional Testing usually describes what the system does.
For this tool, Testing was conducted in phases, as we have implement iterative model where
development and testing went on side by side for each module as correctly shown in figure 14.
1) Negotiation API failing for a floating amount near to the maximum limit.
2) Some API were throwing wrong error messages
3) Code was shown instead of error messages
25
Apart from these, there are other issues which we are expecting and still it has to be adopted by
the whole team and then we will be able to find more issues. We are using it to make system
better.
This time is just for one iteration of the API and will just test one set of values. If a user want to
test for more than (say 5), for 5 attributes add 14 more minutes, which will turn around to
approx. 40 minutes for running an API.
Chapter 9 Conclusion
In this Dissertation an effort is made to automate the functional testing for the API and to
minimize the human effort involved in testing the API. It has been observed that API testing
accounts for around 30% of overall testing in the project and rest components of the software
also calls API for getting the work done.
So automation has brought into picture to cover this major part and it is successful, there are
issues which were there in the system for long were not caught for past ten release are caught and
fixed even before coming to the knowledge of client and thus have added significant value to the
system.
Regression testing which is done in every release and is time consuming has been taken first and
API are automated and thus has reduced significant amount of time for team and is more
effective .
27
This automation tool can be enhanced to do automation directly from the basis of XSD. User
need not to provide anything. System will be intelligent enough to read the XSD and prepare the
automation script.User need not to provide API’s attributes details at all.
Even provision for providing the Pre-written Query could be given for some general basic
attributes which are common in most of the API like phone number, account number, subscriber
id.
Feature can be added to join two scripts so that input of one can act as the output of other. Auto
verification of output can also be accommodated in future version of tool.
28
Appendix I
An API (Application Programming Interface) is a collection of software functions and
procedures, called API calls that can be executed by other software applications. Application
developers code that links to existing APIs to make use of their functionality. This link is
seamless and end-users of the application are generally unaware of using a separately developed
API.
During testing, a test harness—an application that links the API and methodically exercises its
functionality—is constructed to simulate the use of the API by end-user applications. The
interesting problems for testers are:
1. Ensuring that the test harness varies parameters of the API calls in ways that verify
functionality and expose failures. This includes assigning common parameter values as well
as exploring boundary conditions.
2. Generating interesting parameter value combinations for calls with two or more parameters.
3. Determining the content under which an API call is made. This might include setting external
environment conditions (files, peripheral devices, and so forth) and also internal stored data
that affect the API.
4. Sequencing API calls to vary the order in which the functionality is exercised and to make
the API produce useful results from successive calls.
Category partitioning
Create a choice for each value or value-range that forces a default setting to occur. For
example, if the default is to ignore spaces in the string, then we’d want choices that
specify that spaces be present in the input so that this behavior is tested.
29
Create a choice for each value that causes the output to change in some substantive way.
Output could be a return value for a function call or visible displayed results. For
example, if the length of the string is set to 0, it is illegal and an error message will be
displayed. In this case, zero should be a choice for the length category so that this
behavior gets tested.
Create a choice for each value on or around distinguishable “boundaries.” Obviously, 0 is
again a choice for the length category and so is 1 since it is adjacent to the actual
boundary.
Step 3 consists of writing constraints that describe how choices for one category affect choices
for another category. For example, a constraint that specifies that an input choice cannot have
embedded spaces and cannot be of length 0 is required to keep us from considering impossible
choice combinations. Conversely, if we want to force certain choice-combinations to occur, then
a constraint can also be written to achieve this.
When category partitioning is complete, a single input, like the string example above, might be
partitioned into any number of actual values that are necessary for testing. When performing
category-partitioning on an API call with multiple parameters, this number can grow quite large
30
Bibliography
[2] This link provided me with examples to avoid small mistakes in coding
http://www.youtube.com
[3] Overview of various testing concepts
http://en.wikipedia.org
[4] Things to consider during automation
http://www.testpoint.com.au/attachments/093_Seven%20Steps%20to%20Test%20Automatio
n%20Success.pdf