Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Selenium Testing Project report
1. 1
A
PROJECT REPORT
ON
“White Box Testing Using Selenium’’
SUBMITTED TO
BVDU-Amplify-DITM
BY
Mr. Kapil Rajpurohit
Enrollment No BSIT/11/009
Seat No- 1410590005
FOR THE PARTIAL FULFILLMENT OF
BACHELOR OF INFORMATION TECHNOLOGY (B.Sc.(IT) SEM-VI)
FOR THE YEAR 2013-2014
UNDER THE GUIDENCE OF
Mr. Prashant Hinduja
2. 2
HEAD OF DEPARTMENT’S CERTIFICATE
This is to certify that Mr. Kapil Rajpurohit have satisfactorily
completed the project work on “White Box Testing Using Selenium” under
my guidance for the partial fulfillment of B.Sc.(IT) SEM-VI submitted to
“Amplify Mindware DITM " during the academic year 2013-2014. To the best
of my knowledge and belief the matter presented by him are original and not
copied from any source. Also this report has not been submitted earlier for the
award of any Degree of Bharati Vidyapeeth University, Pune.
Place: Pune
Date:
PROF. Prashant Hinduja
(HOD)
3. 3
GUIDE’S CERTIFICATE
This is to certify that Mr. Kapil Rajpurohit have satisfactorily completed
the project work on “White Box Testing Using Selenium’’ “for the partial
fulfillment of B.Sc (IT) SEM VI submitted to “Amplify Mindware DITM” during
the academic year 2013-2014 under my guidance. To the best of my
knowledge and belief the matter presented by him are original and not copied
from any source. Also this report has not been submitted earlier for the award
of any Degree of Bharati Vidyapeeth University, Pune .
Place: Pune
Date:
MR. Prashant Hinduja
(Project Guide)
.
4. 4
DECLARATION
TO,
The Head of Department,
AMPLIFY MINDWARE DITM,
Pune.
I , the undersigned hereby declare that this report entitled “White Box
Testing Using Selenium” is a genuine and benefited work prepared by me
under the guidance of Mr.Prashant Hinduja and this is my original work.
The geniuses of this project is the imagination and thinking of my own. The
matter in this report is not copied from any source. I understand that any such
copy is liable to be punished in any way, the college authorities deemed to fit.
Date:-
Place: - Pune
Mr. Kapil Rajpurohit.
Enrollment. No:BSIT/11/009
5. 5
ACKNOWLEGEMENT
As I developed my project on “White Box Testing Using Selenium”. I have
been fortunate to receive assistance, suggestion and support from numerous
friends and faculty.
First and foremost my thanks go to our guide respected Mr. Prashant
Hinduja , I express my willing of immense gratitude for his guidance and kind
help.
I take this opportunity to thank all my friends who were of great help in the
process of completion of this project.
I also sincerely mark to staff in the computer laboratory for their kind co-operation
& encouragement let me to complete my project work in the time.
Mr.KapilRajpurohit
Enrollment. No:BSIT/11/009
6. 6
CONTENTS
1. Introduction
1.1 Project Profile
1.2 Overall Description
1.3 Technology Required
2. Software testing
2.1 General Testing Terms
2.2 TYPES OF TESTING
2.3 Test Life Cycle
2.4 Software Testing Tools
3. Automation Testing
3.1 Introduction
3.2 Automation Testing Tools
3.3 Test Automation Process
3.4 Automation Framework
4. SELENIUM
4.1 Introduction
4.2 Selenium IDE
4.3 IDE Features
4.4 Selenium Commands
4.5 Selenium Remote Control
4.6 Selenium Core
4.7 Selenium WebDriver
4.8 Firefox Driver
4.9 Android WebDriver
4.10 Firebug
5. Apache POI
5.1 Introduction
5.2 Architecture
5.3 HSSF and XSSF for Excel Documents
7. 6. BrowserMob Proxy (BMP)
7
6.1 Introduction
6.2 HAR Format
7. PROJECT : Website Testing Using Selenium
7.1 Pre-Requisite
7.2 Testing on Website : Orbitz.com
7.3 Testing Using Selenium RC
7.4 Selenium Core
7.5 Automating Flight Website
7.6 Performance Testing
7.7 Performance Testing Using Browsermob
7.8 Data-Driven Testing
7.9 Load Testing and Unit Testing(JUNIT)
7.10 Database Testing using Selenium WebDriver
7.11 Record Test Cases using Monte Media Library.
7.12 Website Testing on Android Emulator
8. References
8. 8
INTRODUCTION
PROJECT PROFILE
Project Title : White Box Testing Using Selenium
Objective : This project aims is to do Performance Testing , Data Driven
Testing , Load Testing , Unit Testing on a Website to
improve its Quality and Saves time from manually doing
these testing.(Additionally White Box Testing on Android
Emulator).
Project Duration : 120 Days
Project Guided by : Mr. Prashant Hinduja
Submitted By : Kapil Rajpurohit
9. Overall Description
This project aims to do the following tasks:
1. White Box Testing using Selenium Remote Control and
9
Selenium Core.
2. White Box Testing using Selenium WebDriver.
3. Performance Testing Using Browsermob framework.
4. Load Testing using Selenium.
5. Data Driven Testing using Selenium and Apache POI.
6. Unit Testing using Selenium and Junit.
7. White Box Testing on Android Emulator using AndroidDriver.
10. Technologies required:
Building Platform:
10
Eclipse IDE , MS-excel.
Frameworks :
Selenium RC , Selenium Core , Selenium
IDE , Selenium WebDriver , Junit , Apache POI , Browsermob ,
Android SDK , AndroidDriver.
Plugins :
Firebug(Firefox plugin)
11. 11
SOFTWARE TESTING
Meaning
It is the process of testing the functionality and correctness of software by running it. Software
testing is usually performed for one of two reasons:
(1) Defect Detection
(2) Reliability or Process of executing a computer program and comparing the actual behavior
with the expected behavior.
Software testing is not an activity to take up when the product is ready. Effective software testing
begins with a proper plan from the user requirements stage itself. Software Testing is an integra l,
costly and time consuming activity in the software development life cycle.
In the software testing phase a application or product undergoes various types of software testing
before it is shipped to the customer or end user. There are about 50 types of software testing
which are available. Software Testing has a different philosophy compared to other activities in
the development life cycle.
Software Testing is not a technique for building quality systems; rather, it is a technique that is
used because we recognize that we have failed to build a defect free system or application.
Software Testing is a verification method that applies a predefined set of conditions for the
purpose of finding defects. Software Testing is a process of executing a program with the
intent of finding errors.
There may be many definitions of software testing and many which appeal to us from time to
time, but its best to start by defining software testing and then move on depending on the
needs.
12. Software Testing Rules
1. Perform the software Test early and test the software often.
2. Integrate the application development and testing life cycles during software testing.
3. Formalize a Software testing methodology; This will help test everything the same way and
help with uniform results.
4. Develop a comprehensive Software Test plan. It forms the basis for the Software Testing
methodology.
5. Use both static and dynamic testing during the software testing phase.
6. Define the expected results early during software testing.
7. Understand the business reason behind the application or software on which you are testing.
You'll write a better test cases or scripts.
8. Use multiple levels and types of testing (regression, systems, integration, stress and load)
during the entire software testing cycle.
9. Review and inspect the work.
10. Don't let your developers check their own work during software testing. They will miss their
own defects.
General Testing Terms
Software Testing: 1. The process of operating a product under certain conditions,
observing and recording the results, and making an evaluation of some part of the product.
2. The process of executing a program or system with the intent of finding
defects/bugs/problems.
3. The process of establishing confidence that a product/application does what it is supposed to.
Verification:"The process of evaluating a product/application/component to evaluate whether
the output of the development phase satisfies the conditions imposed at the start of that phase.
Verification is a Quality control process that is used to check whether or not a product complies
12
13. with regulations, specifications, or conditions imposed at the start of a development phase. This
is often an internal process."
Validation:"The process of evaluating a system or component during or at the end of the
development process to determine whether it satisfies specified user requirements.
Validation is Quality assurance process of establishing evidence that provides a high degree of
assurance that a product accomplishes its intended requirements."
Quality Assurance (QA):"A set of activities designed to ensure that the development and/or
maintenance process is adequate to ensure a system will meet its objectives.
A planned and systematic set of activities necessary to provide adequate confidence
that requirements are properly established and products or services conform to specified
requirements."
Quality Control (QC): The process by which product quality is compared with applicable
standards, and the action is taken when nonconformance is detected.
White Box: In this type of testing we use an internal perspective of the system/product to
design test cases based on the internal structure. It requires programming skills to identify all
flows and paths through the software. The test designer uses test case inputs to exercise
flows/paths through the code and decides the appropriate outputs.
Gray Box: Gray box testing is a software testing method that uses a combination of black box
testing and white box testing. Gray box testing is completely not black box testing, because the
tester will have knowledge of some of the internal workings of the software under test. In gray
box testing, the tester applies a limited number of test cases to the internal workings of the
software under test. In the remaining part of the gray box testing a black box approach is taken in
applying inputs to the software under test and observing the outputs.
Black Box: Black box testing takes an external perspective of the test object to design and
execute the test cases. In this testing technique one need not know the test object's internal
structure. These tests can be functional or non-functional, however these are usually functional.
The test designer selects valid and invalid inputs and determines the correct output.
13
14. Difference between Verification & Validation
TYPES OF TESTING
Black Box Testing
The technique of testing without having any knowledge of
the interior workings of the application is Black Box testing.
The tester is oblivious to the system architecture and does not
have access to the source code. Typically, when performing a
black box test, a tester will interact with the system's user interface
by providing inputs and examining outputs without knowing how
and where the inputs are worked upon. Black box testing takes an
external perspective of the test object to design and execute the test cases. In this testing Fig.3.1
technique one need not know the test object's internal structure. These tests can be functional or
non-functional, however these are usually functional. The test designer selects valid and invalid
inputs and determines the correct output. ..
14
15. White Box Testing
White box testing is the detailed investigation of internal logic and structure of the code. White
box testing is also called glass testing or open box testing. In order to perform white box testing
on an application, the tester needs to possess knowledge of the internal working of the code.
The tester needs to have a look inside the source code and find out which unit/chunk of the code
is behaving inappropriately.
In this type of testing we use an internal perspective of the system/product to design test cases
based on the internal structure. It requires programming skills to identify all flows and paths
through the software. The test designer uses test case inputs to exercise flows/paths through the
code and decides the appropriate outputs.
Grey Box Testing
Grey Box testing is a technique to test the application with limited knowledge of the
internal workings of an application.
In software testing, the term the more you know the better carries a lot of weight when testing an
application. Gray box testing is completely not black box testing, because the tester will have
knowledge of some of the internal workings of the software under test. In gray box testing, the
tester applies a limited number of test cases to the internal workings of the software under test.
In the remaining part of the gray box testing a black box approach is taken in applying inputs to
the software under test and observing the outputs.
Functional Testing:
Functionality testing is performed to verify whether the product/application meets the
intended specifications and the functional requirements mentioned in the documentation.
15
16. Functional tests are written from a user's perspective. These tests confirm that the system
does what the users are expecting it to do.
Both positive and negative test cases are performed to verify the product/application
responds correctly. Functional Testing is critically important for the products success since it
is the customer's first opportunity to be disappointed.
Structural Testing:
In Structural testing, a white box testing approach is taken with focus on the internal
mechanism of a system or component
• Types of structural testing:
– Branch testing
– Path testing
– Statement testing"
System Testing:
System testing of software or hardware is testing conducted on a complete, integrated system to
evaluate the system's compliance with its specified requirements. System testing falls within
the scope of black box testing, and as such, should require no knowledge of the inner design of
the code or logic.
System testing is performed on the entire system with reference of a Functional
Requirement Specification(s) (FRS) and/or a System Requirement Specification (SRS).
Integration Testing:
Integration testing is the activity of software testing in which individual software modules
are combined and tested as a group.
Testing in which software components or hardware components or both are combined and
tested to evaluate the interaction between them.
16
17. Unit Testing:
Testing of individual software components or groups of related components
Testing conducted to evaluate whether systems or components pass data and control correctly
to one another
Regression Testing: When a defect is found in verification and it is fixed we need to verify
that
1) the fix was done correctly
2) to verify that the fix doesn’t break anything else. This is called regression testing.
Regression testing needs to be performed to ensure that the reported errors are indeed fixed.
Testing also needs to be performed to ensure that the fixes made to the application do not
cause new errors to occur.
Selective testing of a system or component to verify that modifications have not
caused unintended effects.
Retesting:
Retesting means executing the same test case after fixing the bug to ensure the bug fixing.
Performance Testing:
Performance test is testing the product/application with respect to various time critical
functionalities. It is related to benchmarking of these functionalities with respect to time.
This is performed under a considerable production sized setup.
Performance Tests are tests that determine end to end timing (benchmarking) of various
time critical business processes and transactions, while the system is under low load, but
with a production sized database. This sets 'best possible' performance expectation under a
17
18. given configuration of infrastructure.
It can also serve to validate and verify other quality attributes of the system, such
as scalability(measurable or quantifiable), reliability and resource usage.
Under performance testing we define the essential system level performance requirements
that will ensure the robustness of the system.
The essential system level performance requirements are defined in terms of key behaviors of
the system and the stress conditions under which the
system must continue to exhibit those key behaviors."
Some examples of the Performance parameters (in a Patient monitoring system - Healthcare
product) are,
1. Real-time parameter numeric values match the physiological inputs
2. Physiological input changes cause parameter numeric and/or waveform modifications on the
display within xx seconds.
3. The system shall transmit the numeric values frequently enough to attain an update rate of x
seconds or shorter at a viewing device.
Stress Testing:
1. Stress Tests determine the load under which a system fails, and how it fails.
2. Testing conducted to evaluate a system or component at or beyond the limits of its specified
requirements to determine the load under which it fails and how.
3. A graceful degradation under load leading to non-catastrophic failure is the desired result.
Often Stress Testing is performed using the same process as Performance Testing but
employing a very high level of simulated load.
Some examples of the Stress parameters (in a Patient monitoring system - Healthcare product)
are,
1. Patient admitted for 72 Hours and all 72 hours of data available for all the parameters (Trends).
2. Repeated Admit / Discharge (Patient Connection and Disconnection)
3. Continuous printing
18
19. 4. Continuous Alarming condition
Load Testing:
Load testing is the activity under which Anticipated Load is applied on the System,
increasing the load slightly and checking when the performance starts to degrade.
Load Tests are end to end performance tests under anticipated production load. The primary
objective of this test is to determine the response times for various time critical transactions
and business processes.
Some of the key measurements provided for a web based application include:
1. How many simultaneous users, can the web site support?
2. How many simultaneous transactions, can the web site support?
3. Page load timing under various traffic conditions.
4. To find the bottlenecks.
Smoke Testing:
In software industry, smoke testing is a wide and shallow approach whereby all areas of the
application are tested, without getting into too deep.
Smoke testing originated in the hardware testing practice of turning on a new piece of
hardware for the first time and considering it a success if it does not catch fire and smoke.
When a build is received, a smoke test is run to ascertain if the build is stable and it can be
considered for further testing. Smoke testing is done by Developer or White box
engineers.
Soak Testing:
Soak testing involves testing a system with a significant load extended over a significant
period of time, to discover how the system behaves under sustained use.
19
20. For example, in software testing, a system may behave exactly as expected when tested for 1
hour. However, when it is tested for 3 hours, problems such as memory leaks cause the system
to fail or behave randomly.
Test Life Cycle / Software Testing models
This page contains a brief description on the Life Cycle and the different Testing Models.
SDLC:
The software development life cycle (SDLC) is a conceptual model used in project manageme nt
that describes the stages involved in an information system development project, from an init ia l
feasibility study through maintenance of the completed application/product.
V-Model:
The V-Model shows and translates the relationships between each phase of the development life
cycle and its associated phase of testing. The V-model is a software development model which is
considered to be an extension of the waterfall model. Instead of moving down in a linear way,
the process steps are targeted upwards after the coding phase, to form the typical V shape.
20
22. Waterfall Model:
The waterfall model is a popular version of the systems development life cycle model for
software engineering. Often considered the classic approach to the systems development life
cycle, the waterfall model describes a development method that is linear and sequential.
Waterfall development has distinct goals for each phase of development. Imagine a waterfall on
the cliff of a steep mountain. Once the water has flowed over the edge of the cliff and has begun
its journey down the side of the mountain, it cannot turn back. It is the same with waterfall
development. Once a phase of development is completed, the development proceeds to the next
phase and there is no turning back.
The advantage of waterfall development is that it allows for departmentalization and managerial
control. A schedule can be set with deadlines for each stage of development and a product can
proceed through the development process like a car in a carwash, and theoretically, be delivered
on time.
The disadvantage of waterfall development is that it does not allow for much reflection or
revision. Once an application is in the testing stage, it is very difficult to go back and
change something that was not well-thought out in the concept stage.
Stages: Project Planning -> Requirements definition -> Design -> Development ->
Integration and Testing -> Installation/Acceptance -> Maintenance
Spiral Model:
There are four phases in the "Spiral Model" which are: Planning, Evaluation, Risk Analysis and
Engineering. These four phases are iteratively followed one after other in order to eliminate all
the problems, which were faced in "The Waterfall Model". Iterating the phases helps in
understating the problems associated with a phase and dealing with those problems when the
same phase is repeated next time, planning and developing strategies to be followed while
iterating through the phases.
22
23. Agile Process:
Agile aims to reduce risk by breaking projects into small, time-limited modules or timeboxes
("iterations") with each iteration being approached like a small, self-contained mini-project,
each lasting only a few weeks. Each iteration has it own self-contained stages of analysis,
design,
production, testing and documentation. In theory, a new software release could be done at the
end of each iteration, but in practice the progress made in one iteration may not be worth a
release and it will be carried over and incorporated into the next iteration. The project's priorities,
direction and progress are re-evaluated at the end of each iteration.
Test life cycle:
1. Test Requirements stage - Requirement Specification documents, Functional
Specification documents, Design Specification documents (use cases, etc), Use
case Documents, Test Trace-ability Matrix for identifying Test Coverage.
2. Test Plan - Test Scope, Test Environment, Different Test phase and Test
Methodologies, Manual and Automation Testing, Defect Management,
Configuration Management, Risk Management, Evaluation & identification – Test,
Defect tracking tools, test schedule, resource allocation.
3. Test Design - Traceability Matrix and Test coverage, Test Scenarios Identification
& Test Case preparation, Test data and Test scripts preparation, Test case reviews and
Approval, Base lining under Configuration Management.
4. Test Environment Setup - Test Bed installation and configuration,
Network connectivity's, All the Software/ tools Installation and
configuration, Coordination with Vendors and others.
5. Test Automation - Automation requirement identification, Tool
Evaluation and Identification, Designing or identifying Framework
and scripting, Script Integration, Review and Approval, Base lining
23
24. under Configuration Management.
6. Test Execution and Defect Tracking - Executing Test cases, Testing
Test Scripts, Capture, review and analyze Test Results, Raise the
defects and tracking for its closure.
7. Test Reports and Acceptance - Test summary reports, Test
Metrics and process Improvements made, Build release, Receiving
acceptance.
Scope
24
Test
Test
System
Accept
Analysi prepara
strategy
Testing
ance
S tion
Testing
SD/DSD Study Define Test Check for Test Test case
and Analysis Strategy & Create Test environment set execution
Participating in approach scripts manual up Defect log and
SD/DSD reviews Plan Testing and automated Execute few status and
Identifying the design & Test data scenarios to reporting
scope of Testing development preparation check the Defect verificat
Activities Review and environment set- and closure
Define confirm test up and Regression Tes
mechanism to Cases application Test summary
track changes Test Bed access report.
Define bug preparation and Communicate
Tracking verification for test data
mechanism readiness requirements to
Define reporting respective teams
Onsite-Offshore Co-ordination
Software Testing Tools
The software testing tools can be classified into the following broad category.
Test Management Tools
White Box Testing Tools
Performance Testing Tools
Automation Testing Tools
25. 25
AUTOMATION TESTING
Introduction
Automation testing which is also known as Test Automation is when the tester writes scripts and
uses another software to test the software. This process involves automation of a manual
process. Automation Testing is used to re-run the test scenarios that were performed manually,
quickly and repeatedly. Apart from regression testing, Automation testing is also used to test the
application from load, performance and stress point of view. It increases the test coverage;
improve accuracy, saves time and money in comparison to manual testing.
Meaning And Objectives
Software Test automation can be defined as,
- Efforts and Activities that are inclined towards programmed engineering tasks and operations
in a software test process.
Goals and Objectives of Software Test Automation
- To reduce Testing Cost and Time.
- To reduce Redundancy.
- To speed up the Testing Process.
- To help improve Quality.
- To improve Test coverage.
- To reduce Manual Intervention.
Note - The above objectives are with respect to a test cycle.
26. Drawbacks
1) If the application / product do not have many release cycles, it is not worth the time and
money automating for one/two cycles.
2) The automation process is expensive.
3) All areas of the application/product cannot be automated. There would be certain limitat ions
in certain areas.
When should the application be automated?
1. When the tests are needed to be executed for every build of the application.
2. When the tests use multiple data values (Retesting / Data Driven Testing).
3. When the tests involve Load or Stress Testing.
When should the application not be automated?
1. If it is a One time testing.
2. When the testing involved is limited to Ad-hoc testing / Exploratory Testing
3. If the Customers requirement are frequently changing.
Automation Testing Tools
The Automation testing tools can be classified as below. Some of the tools are also provided.
a) Functional & Regression Test Tools:
Ex: HP - WinRunner, QTP (Quick Test Professional).
IBM - Rational Robot, RFT (Rational Functional Tester).
Micro Focus - SilkTest.
Open source - Selenium.
b) Performance/Load/Stress test tools
Ex: HP - LoadRunner.
26
27. IBM - RPT (Rational Performance Tester).
Microfocus - Silk Performer.
Open source - Jmeter, WebLOAD.
Test Automation Process
#1 Test Automation - Plan
This is the first step in the test automation process. The major action item here is to create a
plan that specifies Purpose, Scope, Strategies, Major Requirements, Schedule, Budget.
#2 Test Automation - Design and Development
The major action item here is to create a detailed automation solution. This will adress the
major objectives and meet all the automation requirements. This is more of a detailed breakup
adress majority of the automation plan items.
In the development phase the various test automation framework and scripts are developed.
27
28. #3 Test Automation Tool – Preparation
The major action item here is evaluate the various automation tools and decide a on a tool to be
used for the project. This is more of a feasibility study. In this stage an inhouse tool can also be
developed (if feasibile). Once the tool is decided upon, the tool is deployed with the various
required configuration required for the project.
#4 Test Automation solution – Deployment
Once the tool and the scripts are ready, they are integrated together and deployed on the
test environment.
28
29. #5 Test Automation – Review
The working of the automation solution is reviewed and to identify issues and limitations and
provide feedback. This will help to further enhance the solution.
Automation Framework
A test automation framework consists of a set of assumptions, concepts and tools that provide
support for automated software testing. The main advantage of such a framework is the low cost
for maintenance. If there is change to any test case then only the test case file needs to be
updated. However the Driver Script and Startup script will remain the same.
Choosing the right framework/scripting technique helps in maintaining lower costs. The costs
associated with test scripting are due to development and maintenance efforts. The approach
of scripting used during test automation has effect on costs.
Framework/scripting techniques
1. Linear (procedural code, possibly generated by tools like those that use record and
playback)
2. Structured (uses control structures – typically „if-else‟, „switch‟, „for‟,
„while‟ conditions/ statements)
3. Data-driven (data is persisted outside of tests in a database, spreadsheet, or
other mechanism)
4. Keyword-driven
5. Hybrid (two or more of the above patterns are used)
29
30. 30
SELENIUM
Introduction
Selenium is a robust set of tools that supports rapid development of test automation for
web-based applications.
Selenium provides a rich set of testing functions specifically geared to the needs of testing of
a web application.
Selenium operations are highly flexible, allowing many options for locating UI elements
and comparing expected test results against actual application behavior.
Features
• Supports Cross Browser Testing. The Selenium tests can be run on multiple browsers.
• Allows scripting in several languages like Java, C#, PHP and Python.
• Assertion statements provide an efficient way of comparing expected and actual results.
• Inbuilt reporting mechanism.
Components
• Selenium IDE
• Selenium Remote Control
• Selenium Grid
31. Selenium IDE
The Selenium-IDE (Integrated Development Environment) is the tool you use to develop your
Selenium test cases. It’s an easy-to-use Firefox plug-in and is generally the most efficient way to
develop test cases. It also contains a context menu that allows you to first select a UI element
from the browser’s currently displayed page and then select from a list of Selenium commands
with parameters pre-defined according to the context of the selected UI element. This is not only
a time-saver, but also an excellent way of learning Selenium script syntax.
Scripts may be automatically recorded and edited manually providing auto completion support
and the ability to move commands around quickly. Scripts are recorded in Selenese, a special test
scripting language for Selenium. Selenese provides commands for performing actions in a
browser (click a link, select an option), and for retrieving data from the resulting pages
31
32. IDE Features
Menu Bar
The File menu has options for Test Case and Test Suite (suite of Test Cases). Using these you
can add a new Test Case, open a Test Case, save a Test Case, export Test Case in a language of
your choice. You can also open the recent Test Case. All these options are also available for Test
Suite.
The Edit menu allows copy, paste, delete, undo, and select all operations for editing the
commands in your test case. The Options menu allows the changing of settings. You can set the
timeout value for certain commands, add user-defined user extensions to the base set of
Selenium commands, and specify the format (language) used when saving your test cases. The
Help menu is the standard Firefox Help menu; only one item on this menu–UI-Element
Documentation–pertains to Selenium-IDE.
Toolbar
The toolbar contains buttons for controlling the execution of your test cases, including a step
feature for debugging your test cases. The right-most button, the one with the red-dot, is the
record button.
Speed Control: controls how fast your test case runs.
Run All: Runs the entire test suite when a test suite with multiple test cases is loaded.
Run: Runs the currently selected test. When only a single test is loaded this button and
the Run All button have the same effect.
Pause/Resume: Allows stopping and re-starting of a running test case.
Step: Allows you to “step” through a test case by running it one command at a time. Use
for debugging test cases.
TestRunner Mode: Allows you to run the test case in a browser loaded with the
Selenium-Core TestRunner. The TestRunner is not commonly used now and is likely to
be deprecated. This button is for evaluating test cases for backwards compatibility with
the TestRunner. Most users will probably not need this button.
32
33. Apply Rollup Rules: This advanced feature allows repetitive sequences of Selenium
commands to be grouped into a single action. Detailed documentation on rollup rules can
be found in the UI-Element Documentation on the Help menu.
Record: Records the user’s browser actions.
Test Case Pane
Your script is displayed in the test case pane. It has two tabs, one for displaying the command
and their parameters in a readable “table” format.
The other tab - Source displays the test case in the native format in which the file will be stored.
By default, this is HTML although it can be changed to a programming language such as Java or
C#, or a scripting language like Python. See the Options menu for details. The Source view also
allows one to edit the test case in its raw form, including copy, cut and paste operations.
The Command, Target, and Value entry fields display the currently selected command along
with its parameters. These are entry fields where you can modify the currently selected
command. The first parameter specified for a command in the Reference tab of the bottom pane
always goes in the Target field. If a second parameter is specified by the Reference tab, it always
goes in the Value field.
If you start typing in the Command field, a drop-down list will be populated based on the first
characters you type; you can then select your desired command from the drop-down.
Log/Reference/UI-Element/Rollup Pane
The bottom pane is used for four different functions–Log, Reference, UI-Element, and Rollup–
depending on which tab is selected.
33
34. 34
Log
When you run your test case, error messages and information messages showing the progress are
displayed in this pane automatically, even if you do not first select the Log tab. These messages
are often useful for test case debugging. Notice the Clear button for clearing the Log. Also notice
the Info button is a drop-down allowing selection of different levels of information to log.
Reference
The Reference tab is the default selection whenever you are entering or modifying Selenese
commands and parameters in Table mode. In Table mode, the Reference pane will display
documentation on the current command. When entering or modifying commands, whether from
Table or Source mode, it is critically important to ensure that the parameters specified in the
Target and Value fields match those specified in the parameter list in the Reference pane. The
number of parameters provided must match the number specified, the order of parameters
provided must match the order specified, and the type of parameters provided must match the
type specified. If there is a mismatch in any of these three areas, the command will not run
correctly.
While the Reference tab is invaluable as a quick reference, it is still often necessary to consult
the Selenium Reference document.
UI-Element and Rollup
Detailed information on these two panes (which cover advanced features) can be found in the
UI-Element Documentation on the Help menu of Selenium-IDE.
35. Running Test Cases
The IDE allows many options for running your test case. You can run a test case all at once, stop
and start it, run it one line at a time, run a single command you are currently developing, and you
can do a batch run of an entire test suite. Execution of test cases is very flexible in the IDE.
Run a Test Case
35
Click the Run button to run the currently displayed test case.
Run a Test Suite
Click the Run All button to run all the test cases in the currently loaded test suite.
Stop and Start
The Pause button can be used to stop the test case while it is running. The icon of this
button then changes to indicate the Resume button. To continue click Resume.
Stop in the Middle
You can set a breakpoint in the test case to cause it to stop on a particular command.
This is useful for debugging your test case. To set a breakpoint, select a command,
right-click, and from the context menu select Toggle Breakpoint.
Start from the Middle
You can tell the IDE to begin running from a specific command in the middle of the
test case. This also is used for debugging. To set a startpoint, select a command, right-click,
and from the context menu select Set/Clear Start Point.
Run Any Single Command
Double-click any single command to run it by itself. This is useful when writing a
single command. It lets you immediately test a command you are constructing, when
you are not sure if it is correct. You can double-click it to see if it runs correctly. This
is also available from the context menu.
Commonly Used Selenium Commands
To conclude our introduction of Selenium, we’ll show you a few typical Selenium commands.
These are probably the most commonly used commands for building tests.
open
opens a page using a URL.
click/clickAndWait
performs a click operation, and optionally waits for a new page to load.
36. verifyTitle/assertTitle
36
verifies an expected page title.
verifyTextPresent
verifies expected text is somewhere on the page.
verifyElementPresent
verifies an expected UI element, as defined by its HTML tag, is present on the page.
verifyText
verifies expected text and its corresponding HTML tag are present on the page.
verifyTable
verifies a table’s expected contents.
waitForPageToLoad
pauses execution until an expected new page loads. Called automatically when
clickAndWait is used.
waitForElementPresent
pauses execution until an expected UI element, as defined by its HTML tag, is present
on the page.
Selenium Remote Control
Selenium Remote Control (RC) is a test tool that allows you to write automated web
application UI tests in any programming language against any HTTP website using any
mainstream JavaScript-enabled browser.
Selenium RC comes in two parts.
1. A server which automatically launches and kills browsers, and acts as a HTTP proxy
for web requests from them.
2. Client libraries for your favorite computer language.
37. Here is a simplified architectural representation....
The diagram shows the client libraries communicate with the Server passing each Selenium
command for execution. Then the server passes the Selenium command to the browser using
Selenium-Core JavaScript commands. The browser, using its JavaScript interpreter, executes the
37
38. Selenium command. This runs the Selenese action or verification you specified in your test
script.
Selenium Remote Control is great for testing complex AJAX-based web user interfaces under a
Continuous Integration system. It is also an ideal solution for users of Selenium IDE who want to
write tests in a more expressive programming language than the Selenese HTML table format.
Selenium Server
Selenium Server receives Selenium commands from your test program, interprets them, and
reports back to your program the results of running those tests.
The RC server bundles Selenium Core and automatically injects it into the browser. This occurs
when your test program opens the browser (using a client library API function). Selenium-Core
is a JavaScript program, actually a set of JavaScript functions which interprets and executes
Selenese commands using the browser’s built-in JavaScript interpreter.
The Server receives the Selenese commands from your test program using simple HTTP
GET/POST requests. This means you can use any programming language that can send HTTP
requests to automate Selenium tests on the browser.
Client Libraries
The client libraries provide the programming support that allows you to run Selenium commands
from a program of your own design. There is a different client library for each supported
language. A Selenium client library provides a programming interface (API), i.e., a set of
functions, which run Selenium commands from your own program. Within each interface, there
is a programming function that supports each Selenese command.
The client library takes a Selenese command and passes it to the Selenium Server for processing
a specific action or test against the application under test (AUT). The client library also receives
the result of that command and passes it back to your program. Your program can receive the
result and store it into a program variable and report it as a success or failure, or possibly take
corrective action if it was an unexpected error.
So to create a test program, you simply write a program that runs a set of Selenium commands
using a client library API. And, optionally, if you already have a Selenese test script created in
the Selenium-IDE, you can generate the Selenium RC code. The Selenium-IDE can translate
(using its Export menu item) its Selenium commands into a client-driver’s API function calls.
See the Selenium-IDE chapter for specifics on exporting RC code from Selenium-IDE.
Running Selenium Server
Before starting any tests you must start the server. Go to the directory where Selenium RC’s
server is located and run the following from a command-line console.
java -jar selenium-server-standalone-<version-number>.jar
38
39. This can be simplified by creating a batch or shell executable file (.bat on Windows and .sh on
Linux) containing the command above. Then make a shortcut to that executable on your desktop
and simply double-click the icon to start the server.
For the server to run you’ll need Java installed and the PATH environment variable correctly
configured to run it from the console. You can check that you have Java correctly installed by
running the following on a console.
java -version
If you get a version number (which needs to be 1.5 or later), you’re ready to start using Selenium
RC.
Selenium Core
Selenium Core is a JavaScript-based test tool for Web applications. Selenium Core tests run
directly in a browser, just as real users do. And they run in Internet Explorer, Mozilla, and
Firefox on Windows, Linux, and Macintosh.
Selenium Core tests run directly in a browser, just as real users do. And they run in Internet
Explorer, Mozilla and Firefox on Windows, Linux and Macintosh. No other test tool covers such
a wide array of platforms. Team of programmers and testers at Thought Works developed it.
It allows the tests to run in any supported browser on the client-side, mainly allows you to do the
following:
Browser compatibility testing: Test your application to see if it works correctly on different
browsers and operating systems. The same script can run on any Selenium platform.
System functional testing: Create regression tests to verify application functionality and user
acceptance.
39
40. Selenium WebDriver
Selenium WebDriver is the successor to Selenium RC. Selenium WebDriver accepts commands
(sent in Selenese, or via a Client API) and sends them to a browser. This is implemented through
a browser-specific browser driver, which sends commands to a browser, and retrieves results.
Most browser drivers actually launch and access a browser application (such as Firefox or
Internet Explorer); there is also an HtmlUnit browser driver, which simulates a browser using
HtmlUnit.
40
41. Unlike in Selenium 1, where the Selenium server was necessary to run tests, Selenium
WebDriver does not need a special server to execute tests. Instead, the WebDriver directly starts
a browser instance and controls it. However, Selenium Grid can be used with WebDriver to
execute tests on remote systems.
In practice, this means that the Selenium 2.0 API has significantly fewer calls than does the
Selenium 1.0 API. Where Selenium 1.0 attempted to provide a rich interface for many different
browser operations, Selenium 2.0 aims to provide a basic set of building blocks from which
developers can create their own Domain Specific Language. One such DSL already exists: the
Watir project in the Ruby language has a rich history of good design. Watir-webdriver
implements the Watir API as a wrapper for Selenium-Webdriver in Ruby. Watir-webdriver is
created entirely automatically, based on the WebDriver specification and the HTML
specification.
As of early 2012, Simon Stewart (inventor of WebDriver), who was then with Google and now
with Facebook, and David Burns of Mozilla were negotiating with the W3C to make WebDriver
an internet standard. In early 2013, the working draft was released.. As such, Selenium-
Webdriver (Selenium 2.0) aims to be the reference implementation of the WebDriver standard in
various programming languages. Currently Selenium-WebDriver is fully implemented and
supported in Python, Ruby, Java, and C#.
The biggest change in Selenium recently has been the inclusion of the WebDriver API. Driving a
browser natively as a user would either locally or on a remote machine using the Selenium
Server it marks a leap forward in terms of browser automation.
Selenium WebDriver fits in the same role as RC did, and has incorporated the original 1.x
bindings. It refers to both the language bindings and the implementations of the individual
browser controlling code. This is commonly referred to as just "WebDriver" or sometimes as
Selenium 2.
Selenium 1.0 + WebDriver = Selenium 2.0
WebDriver is designed in a simpler and more concise programming interface along
41
with addressing some limitations in the Selenium-RC API.
WebDriver is a compact Object Oriented API when compared to Selenium1.0
It drives the browser much more effectively and over comes the limitations of
Selenium 1.x which affected our functional test coverage, like the file upload or
download, pop-ups and dialogs barrier
42. Firefox Driver
Firefox driver is included in the selenium-server-stanalone.jar available in the downloads. The
driver comes in the form of an xpi (firefox extension) which is added to the firefox profile when
you start a new instance of FirefoxDriver.
Android WebDriver
Android WebDriver allows to run automated end-to-end tests that ensure your site works
correctly when viewed from the Android browser. Android WebDriver supports all core
WebDriver APIs, and in addition to that it supports mobile spacific and HTML5 APIs. Android
WebDriver models many user interactions such as finger taps, flicks, finger scrolls and long
presses. It can rotate the display and interact with HTML5 features such as local storage, session
storage and application cache.
Android WebDriver test can run on emulators or real devices for phone and tablets.
Firebug
Firebug is a web development tool that facilitates the debugging, editing, and monitoring of any
website's CSS, HTML, DOM, XHR, and JavaScript; it also provides other web development
tools.[2] Firebug's JavaScript panel can log errors, profile function calls, and enable the developer
to run arbitrary JavaScript. Its net panel can monitor URLs that the browser requests, such as
42
43. external CSS, JavaScript, and image files. The net panel can display both request headers and
response headers for each page asset; it can also estimate the time each asset took to load.
Firebug is free and open source; it is licensed under the BSD license. Firebug was initially
written in January 2006 by Joe Hewitt, one of the original Firefox creators. The Firebug Working
Group oversees the open source development and extension of Firebug. It has two major
implementations: an extension (add-on) for Mozilla Firefox and a bookmarklet implementation
called Firebug Lite. A cross-browser version is in development. Currently, the Firebug add-on
has over 3 million active daily users.
In addition to debugging web pages, Firebug is a useful tool for web security testing and web
page performance analysis
43
44. Apache POI
Apache POI, a project run by the Apache Software Foundation, and previously a sub-project of
the Jakarta Project, provides pure Java libraries for reading and writing files in Microsoft Office
formats, such as Word, PowerPoint and Excel.
POI supports the ISO/IEC 29500:2008 Office Open XML file formats since version 3.5. A
significant contribution for OOXML support came from Sourcesense, an open source company
which was commissioned by Microsoft to develop this contribution. This link spurred
controversy, some POI contributors questioning POI OOXML patent protection regarding
Microsoft's Open Specification Promise patent license
The Apache POI Project's mission is to create and maintain Java APIs for manipulating
various file formats based upon the Office Open XML standards (OOXML) and Microsoft's
OLE 2 Compound Document format (OLE2). In short, you can read and write MS Excel files
using Java. In addition, you can read and write MS Word and MS PowerPoint files using Java.
Apache POI is your Java Excel solution (for Excel 97-2008). We have a complete API for
porting other OOXML and OLE2 formats and welcome others to participate.
OLE2 files include most Microsoft Office files such as XLS, DOC, and PPT as well as MFC
serialization API based file formats. The project provides APIs for the OLE2 Filesystem
(POIFS) and OLE2 Document Properties (HPSF).
Office OpenXML Format is the new standards based XML file format found in Microsoft
Office 2007 and 2008. This includes XLSX, DOCX and PPTX. The project provides a low
level API to support the Open Packaging Conventions using openxml4j.
For each MS Office application there exists a component module that attempts to provide a
common high level Java api to both OLE2 and OOXML document formats. This is most
developed for Excel workbooks (SS=HSSF+XSSF). Work is progressing for Word documents
(HWPF+XWPF) and PowerPoint presentations (HSLF+XSLF).
The project has recently added support for Outlook (HSMF). Microsoft opened the
specifications to this format in October 2007. We would welcome contributions.
There are also projects for Visio (HDGF), TNEF (HMEF), and Publisher (HPBF).
As a general policy we collaborate as much as possible with other projects to provide this
functionality. Examples include: Cocoon for which there are serializers for HSSF; Open
Office.org with whom we collaborate in documenting the XLS format; and Tika / Lucene, for
which we provide format interpretors. When practical, we donate components directly to those
projects for POI-enabling them.
44
45. Architecture
The Apache POI project contains the following subcomponents (meaning of acronyms is taken
from old documentation):
POIFS (Poor Obfuscation Implementation File System) – This component reads and
writes Microsoft's OLE 2 Compound document format. Since all Microsoft Office files
are OLE 2 files, this component is the basic building block of all the other POI elements.
POIFS can therefore be used to read a wider variety of files, beyond those whose explicit
decoders are already written in POI.
HSSF (Horrible SpreadSheet Format) – reads and writes Microsoft Excel (XLS) format
files. It can read files written by Excel 97 onwards; this file format is known as the BIFF
8 format. As the Excel file format is complex and contains a number of tricky
characteristics, some of the more advanced features cannot be read.
XSSF (XML SpreadSheet Format) – reads and writes Office Open XML (XLSX) format
files. Similar feature set to HSSF, but for Office Open XML files.
HPSF (Horrible Property Set Format) – reads "Document Summary" information from
Microsoft Office files. This is essentially the information that one can see by using the
File|Properties menu item within an Office application.
HWPF (Horrible Word Processor Format) – aims to read and write Microsoft Word 97
(DOC) format files. This component is in initial stages of development.
HSLF (Horrible Slide Layout Format) – a pure Java implementation for Microsoft
PowerPoint files. This provides the ability to read, create and edit presentations (though
some things are easier to do than others)
HDGF (Horrible DiaGram Format) – an initial pure Java implementation for Microsoft
Visio binary files. It provides an ability to read the low level contents of the files.
HPBF (Horrible PuBlisher Format) – a pure Java implementation for Microsoft Publisher
files.
HSMF (Horrible Stupid Mail Format) – a pure Java implementation for Microsoft
Outlook MSG files.
DDF (Dreadful Drawing Format) – a package for decoding the Microsoft Office Drawing
format.
The HSSF component is the most advanced feature of the library. Other components (HPSF,
HWPF, and HSLF) are usable, but less full- featured.
The POI library is also provided as a Ruby or ColdFusion extension.
45
46. HSSF and XSSF for Excel Documents
HSSF is our port of the Microsoft Excel 97(-2007) file format (BIFF8) to pure Java. XSSF is our
port of the Microsoft Excel XML (2007+) file format (OOXML) to pure Java. SS is a package
that provides common support for both formats with a common API. They both support read and
write capability. Please see the HSSF+XSSF project page for more information.
46
47. BrowserMob Proxy (BMP)
BrowserMob proxy is based on technology developed in the Selenium open source project and a
commercial load testing and monitoring service originally called BrowserMob and now part of
Neustar.
The proxy is a free (Apache 2.0 license) utility that works well with Selenium or can be used
independently.
It is a simple utility that makes it easy to capture performance data from browsers, typically
written using automation toolkits such as Selenium and Watir.
It can capture performance data for web apps (via the HAR format), as well as manipulate
browser behavior and traffic, such as whitelisting and blacklisting content, simulating network
traffic and latency, and rewriting HTTP requests and responses.
What is a HAR format ?
HAR(HTTP Archive) is a online tool visualizing. HAR is produced by the HTTP tracking tools,
these files captures the details of the client/server communication and this can be used for
analysis like Page Load Performance.
How the HAR files will look ?
proxy is programmatically controlled via a REST interface or by being embedded directly inside
Java-based programs and unit tests.It can control HTTP trafic for,
blacklisting and whitelisting certain URL patterns
simulating various bandwidth and latency
remapping DNS lookups
flushing DNS caching
controlling DNS and request timeouts
automatic BASIC authorization
47
49. 49
PROJECT : Website Testing Using Selenium
Pre-Requisite :
Website : www.orbitz.com
Eclipse IDE
Selenium IDE
Selenium RC
Selenium Core
Firebug (Firefox plug-in)
Selenium Webdriver
Junit
Apache POI
Browsermob
Monte Screen Recorder
Android SDK
Selenium AndroidDriver
Testing on Website : Orbitz.com
Orbitz Worldwide, Inc. is a company that operates a web site used to research, plan and
book travel. It is headquartered in the Citigroup Center in Near West Side, Chicago,
Illinois, United States. Orbitz Worldwide is a publicly traded company listed on the New
York Stock Exchange following its initial public offering (IPO) in July 2007. Orbitz
Worldwide’s largest investor is Travelport.
50. Orbitz runs on a mixed Red Hat Linux and Sun Solaris based platform and was an early adopter
of Sun's Jini platform in a clustered Java environment. Both JBoss and Oracle WebLogic Server
are used as application servers within their environment along with various other proprietary and
open source software. Orbitz licenses ITA Software's Lisp-powered QPX software to power their
site. Orbitz Worldwide brands have been migrated to a common technology platform, which
enables the same platform to service multiple travel brands in multiple languages in different
markets and currencies as well.
Orbitz has released parts of its Complex Event Processing infrastructure as Open Source.
Orbitz will let you search for the lowest price over a weekend you designate; search up to three
days before and after your dates; or look for the lowest published fare within a 30-day period.
The site recently extended its flexible search option to include international flights, though at
press time, it still indicated that the destination airport "must be within 50 U.S. states, Puerto
Rico, U.S. Virgin Islands, or Canada." Expedia's flexible search provides a pull-down list of 50
popular U.S. destinations only.
50
51. Testing Using Selenium RC
Selenium Remote Control (RC) is a test tool that allows you to write automated web
application UI tests in any programming language against any HTTP website using any
mainstream JavaScript-enabled browser.
Download Selenium RC from http://docs.seleniumhq.org/download/
51
52. Start selenium RC Server using command prompt
Start: (Command line)
java -jar selenium-server-standalone-2.0b3.jar –port 4444
52
54. Selenium Core :
Selenium Core is a JavaScript-based test tool for Web applications. Selenium Core tests run
directly in a browser, just as real users do. And they run in Internet Explorer, Mozilla, and
Firefox on Windows, Linux, and Macintosh.
Selenium Core tests run directly in a browser, just as real users do. And they run in Internet
Explorer, Mozilla and Firefox on Windows, Linux and Macintosh. No other test tool covers such
a wide array of platforms. Team of programmers and testers at Thought Works developed it.
54
56. Performance Testing
performance testing is in general testing performed to determine how a system performs in terms
of responsiveness and stability under a particular workload. It can also serve to investigate,
measure, validate or verify other quality attributes of the system, such as scalability, reliability
and resource usage.
It is critical to the cost performance of a new system, that performance test efforts begin at the
inception of the development project and extend through to deployment. The later a performance
defect is detected, the higher the cost of remediation. This is true in the case of functional testing,
but even more so with performance testing, due to the end-to-end nature of its scope. It is crucial
for a performance test team to be involved as early as possible because key performance
requisites like test environment acquisition and preparation is often a lengthy and time
consuming process.
Performance Testing Using Browsermob
BrowserMob proxy is based on technology developed in the Selenium open source project and a
commercial load testing and monitoring service originally called BrowserMob and now part of
Neustar.
It can capture performance data for web apps (via the HAR format), as well as manipulate
browser behavior and traffic, such as whitelisting and blacklisting content, simulating network
traffic and latency, and rewriting HTTP requests and responses.
56
58. Data-Driven Testing
Data-driven testing (DDT) is a term used in the testing of computer software to describe testing
done using a table of conditions directly as test inputs and verifiable outputs as well as the
process where test environment settings and control are not hard-coded. In the simplest form the
tester supplies the inputs from a row in the table and expects the outputs which occur in the same
row. The table typically contains values which correspond to boundary or partition input spaces.
In the control methodology, test configuration is "read" from a database.
Data-driven testing is the creation of test scripts to run together with their related data sets in a
framework. The framework provides re-usable test logic to reduce maintenance and improve test
coverage. Input and result (test criteria) data values can be stored in one or more central data
sources or databases, the actual format and organisation can be implementation specific.
TestComplete supports Excel spreadsheets, CSV files and just about any database including
Microsoft SQL Server, Oracle, MySQL, Microsoft Access, Interbase and others for data-driven
testing. You can also implement data retrieval from custom sources, such as XML or INI files.
58
59. Use of Apache POI Framework for Data Driven Testing
59
60. Libraries Used :
60
org.apache.commons.io.FileUtils
org.apache.poi.xssf.usermodel.XSSFCell
org.apache.poi.xssf.usermodel.XSSFRow
org.apache.poi.xssf.usermodel.XSSFSheet
org.apache.poi.xssf.usermodel.XSSFWorkbook
63. Load Testing and Unit Testing(JUNIT)
Load testing is the process of putting demand on a system or device and measuring its
response. Load testing is performed to determine a system’s behavior under both normal and
anticipated peak load conditions. It helps to identify the maximum operating capacity of an
application as well as any bottlenecks and determine which element is causing degradation.
When the load placed on the system is raised beyond normal usage patterns, in order to test the
system's response at unusually high or peak loads, it is known as stress testing . The load is
usually so great that error conditions are the expected result, although no clear boundary exists
when an activity ceases to be a load test and becomes a stress test.
unit testing is a software testing method by which individual units of source code, sets of
one or more computer program modules together with associated control data, usage procedures,
and operating procedures are tested to determine if they are fit for use. Intuitively, one can view
a unit as the smallest testable part of an application. In procedural programming, a unit could be
an entire module, but it is more commonly an individual function or procedure. In object-oriented
programming , a unit is often an entire interface, such as a class, but could be an
individual method. Unit tests are short code fragments created by programmers or occasionally
by white box testers during the development process.
JUnit is a unit testing framework for the Java programming language. JUnit has been
important in the development of test-driven development, and is one of a family of unit testing
frameworks which is collectively known as xUnit that originated with SUnit.
JUnit is linked as a JAR at compile-time; the framework resides under package
junit.framework for JUnit 3.8 and earlier, and under package org.junit for JUnit 4 and
later.
A JUnit test fixture is a Java object. With older versions of JUnit, fixtures had to inherit
from junit.framework.TestCase, but the new tests using JUnit 4 should not do this. Test
methods must be annotated by the @Test annotation . If the situation requires it, it is also
possible to define a method to execute before (or after) each (or all) of the test methods with the
@Before (or @After) and @BeforeClass (or @AfterClass) annotations.
63
64. Load and Unit Testing on website :
Program logic :
Output :
64
65. Database Testing using Selenium WebDriver
Creating Data Source ODBC
Access Database :
65
66. Program Logic :
Record Test Cases using Monte Media Library and Selenium
The Monte Media Library is a Java library for processing media data. Supported media
formats include still images, video, audio and meta-data.
This library has some overlap in functionality with the Java Media Framework (JMF).
For some codecs, the Monte Media Library provides wrappers, which allow to use them with
JMF. However, in general, Monte Media is not compatible with JMF.
66
68. Website Testing on Android Emulator
The Android SDK includes a mobile device emulator — a virtual mobile device that runs
on your computer. The emulator lets you develop and test Android applications without using a
physical device.
The Android emulator is a virtual mobile device running on your computer. The software
emulates an Android device, running the Android OS, for debugging applications without
needing a variety of devices and OS versions. The Android emulator has various settings to make
possible the emulation of a large set of Android devices.
Installing Android Server APK using Command Prompt
set up the port forwarding in order to forward the traffic from the
host machine to the emulator by using command :
68
adb forward tcp:8080 tcp:8080
http://localhost:8080/wd/hub