STA Lab Manuel Student
STA Lab Manuel Student
Aim:
To develop the test plan for testing an e-commerce web/mobile application.
Procedures:
1 Introduction
The Test Plan is designed to prescribe the scope, approach, resources, and schedule of all testing
activities of the project Guru99 Bank.
The plan identify the items to be tested, the features to be tested, the types of testing to be performed,
the personnel responsible for testing, the resources and schedule required to complete testing, and the
risks associated with the plan.
Scope
In Scope
All the feature of websiteGuru99 Bank which were defined in software requirement specs are need to
be tested
Out of Scope
These feature are not be tested because they are not included in the software requirement specs
User Interfaces
Hardware Interfaces
Software Interfaces
Database logical
Communications Interfaces
Website Security and Performance
Quality Objective
The test objectives are to verify the Functionality of website Guru99 Bank, the project should focus
on testing the banking operation such as Account Management, Withdrawal, and Balance…etc.
to guarantee all these operation can work normally in real business environment.
Overview
Test Levels
In the project Guru99 Bank, there’re 3 types of testing should be conducted.
Integration Testing (Individual software modules are combined and tested as a group)
System Testing: Conducted on a complete, integrated system to evaluate the system’s
compliance with its specified requirements
/[Link]: Test all the APIs create for the software under tested
Bug Triage
Test Completeness
3. Test Deliverables
Test deliverables are provided as below
– Test Data
Test Results/reports
Defect Report
Installation/ Test procedures guidelines
Release notes
4. Resource & Environment Needs
Develop a Test tool which can auto generate the test result to the predefined form and
2. Test tool
automated test execution
3. Network Setup a LAN Gigabit and 1 internet line with the speed at least 5 Mb/s
Test Environment
It mentions the minimum hardware and software requirements that will be used to test the
Application.
Result:
Thus the test plan for testing the e-commerce web application has been developed
successfully.
Ex. No. 2
Date: Develop the test case for testing the e-commerce application
Aim:
To develop the test case for testing the e-commerce application.
The user should be able to navigate to all the pages in the website
There should be a fallback page for any page load errors
Verify that all the links and banners work properly
Search results should be displayed with the most relevant item being shown first
All data related to the product – title, price, images, and description are all visible
clearly
Maintain a session for each user and test verify the session times out after a while
i. Login/Registration test cases for Online Shopping Website
Test that authenticated sellers can access authorized product creation panels under
authorized categories.
Test the maximum product creation limit to avoid adding more products to the catalog.
Test that seller’s products are visible after some time
Test the product creation process is working fine for the seller
Test that there are no duplicate products
Test what parameters the search is based on – for example, product name, brand
name, category, etc.
Test if the search results are relevant
Number of results to be displayed per page
Test whether the search API is being called at every keystroke. (This isn’t
recommended, as it would unnecessarily cause multiple API calls to the
database)
iv. Filter Results
Test if the user can filter based on all the parameters on the page
The user should be able to see results with default search criteria when at least one of
the filter parameters isn’t mandatory
Validation messages for invalid filter criteria
When at least one filter criteria are required, and the user selects none, proper error
messages are shown
Example of a filter
v. Product Detail Test Cases
Test that all the product details are displayed correctly and that no empty/invalid details
are displayed.
Product Images should be optimized for size and dimensions, which further helps
in performance testing.
If there’s breadcrumb navigation, each link in the breadcrumb should be functional.
Below is an example of breadcrumb navigation.
All the links(size, Pincode check, etc) about the product should be functional.
vi. Shopping Cart
viii. Payments
Perform security testing if in case the user’s credit card details need to be saved
For returning customers, they should be redirected to log in for checkout
User should be logged out after the session times out
Emails/test confirmation when the order is confirmed
As you can see, an eCommerce website has many more tests or features, and testing
each is very time-consuming and requires effort.
Result:
Thus the test cases for testing the e-commerce web application has been developed
successfully.
Ex. No. 3
Test the e-commerce application and report the defects in it
Date:
Aim:
To test the e-commerce application and report the defects in it.
In today’s world, I bet you won’t find anyone who hasn’t shopped online. E-commerce/Retail is
a business that thrives on its online customers. Shopping in person vs. shopping online has many
advantages. Convenience, time-saving and easy access to products worldwide, etc.
A good E-commerce/Retail site is key to its success. It must be a worthy counterpart to the
storefront. Because, when you go shopping at a physical store, the customer has already made a
commitment to visit and might give the brand a chance.
The better the site, the better the [Link] so much lays on the application, it is
critical that it undergoes thorough testing.
E-commerce application/sites are web applications or mobile application too. So, they
undergo all the typical test types.
Functional Testing
Usability Testing
Security Testing
Performance Testing
Database Testing
Mobile Application Testing
A/B testing.
1) Homepage – Hero Image
Homepages of retail sites are busy. They have a lot going on. But almost all of them
have a Hero Image:
This is the kind of the clickable image (a slideshow of sorts) that occupies the majority
of the page.
Check:
Image or images of the product
Price of the product
Product specifications
Reviews
Check out options
Delivery options
Shipping information
In-stock/Out of stock
Multiple color or variations options
Breadcrumb navigation for the categories (highlighted in Red below). If
navigation such as that is displayed, make sure every element of it is functional.
4) Shopping Cart
This is the penultimate stage before the user commits to the purchase.
Since these are dynamic elements, the best way to test these parts of the application is to
test the algorithm based on which these sections are populated.
Check your Data mining/BI systems and check from the backend the queries that
populate these sections.
7) After-Order Tests
Check:
Change the Order
Cancel the Order
Track the Order
Returns
8) Other Tests
Login
FAQs
Contact Us page
Customer Service page etc.
Result:
Thus the e-commerce application has been tested successfully.
Ex. No. 4
Date: Develop the test plan and design the test cases for an inventory control system
Aim:
To develop the test plan and design the test cases for an inventory control system.
More specifically, a test case design is a document that includes the test’s scope, the test strategy,
the test environment, the software pieces for testing, the intended test actions within the project,
the resources, and a schedule.
Thus, developing test case designs aims to define the test strategy within the project; plan resource
allocation; and clarify responsibilities, risks, and priorities.
However, as applications change, test cases may require updates. Therefore, preparing test case
designs begins with the early stages of the software lifecycle. A test case design plan is sometimes
a product or tool for performing necessary functions within a project’s scope.
After an engineer completes the test case planning process, the test case design process begins.
This process includes
Test engineers run various tests in an environment that includes the software and hardware they
describe. While preparing the test environment, engineers develop auxiliary test software to use
in the tests.
1. Test data generators—This software produces the test input data necessary to execute test
cases.
2. Debugger—This software enables errors encountered during the tests to be found on the
source code.
3. Emulators and simulators—These software types imitate the real hardware that the
software needs; they provide the hardware data necessary for the tests.
4. Stubs and drivers—These small pieces of software replace nonfunctional system
components required for tests.
Engineers must record the test environment used for testing, hardware specifications, software
versions, etc., so that if the same test must run again, these records are available for reuse.
After a software project’s requirements are approved, the test case design phase begins. While
system analysts, system engineers, and software engineers prepare the system requirements and
software requirements, the test team determines the test strategy suitable for the project and
updates the relevant test plans.
Then, while system and software developers perform preliminary design and detailed designs, the
test team starts to create test cases.
Engineers can validate a requirement with one test case or multiple test cases. For this purpose,
they should write at least one test case for each requirement to demonstrate that the developed
software meets all of its specifications.
However, these written test cases are usually positive test cases that’ll test the requirement’s
positive side. In addition, the necessary requirements should also include test cases that show how
the software will behave in negative situations.
When the developed software performs all of the expected behaviors, this indicates that all
software test cases have been tested.
A test case is an input used to demonstrate that a particular part of the program works, or that a
requirement is verified, the necessary steps taken, and the test has yielded the expected results.
Engineers should only test one item property at a time. Thus, if the test case runs and fails, it’s
easy to see which feature is problematic. In addition, test cases should include known inputs.
Moreover, these inputs and expected outputs are given as validation points in test cases.
If the software gives the expected inputs and expected result, the relevant test case passed.
Furthermore, tests performed when all or a specified proportion of the tested item’s test cases pass
are considered successful.
Test Test
Expected Actual Requirement
Case Objective Category Condition
Results Results ID
ID ID
CMake
Server- (previous
0048 0011 Passes Failed 00132
Side version
will used)
Test Case ID :
Comments Incorporated By: Date
Reviewer :
Incorporated :
Date of Review :
New Version :
Version :
Severity
C – Critical Close
No Page No Step No Comments Action
M – Major (Y/ N)
S – Small
4
Test Case ID : Reviewer
Comments Incorporated By:
:
Date Incorporated :
Date of Review :
Version : New Version :
Engineers can implement these test cases and write test scripts to record the results manually or
automatically. Whether test case applications are manual or automatic, they should be recorded
under all circumstances.
Tests in software projects are carried out in four different stages. As these tests’ detail levels
increase, the size of the piece tested decreases.
1. unit tests,
2. software integration tests,
3. system tests, and
4. acceptance tests.
Unit Tests
Unit tests confirm that small pieces of code, such as methods, procedures, or classes, are working
correctly. In order to do this, separate the unit tested from other units. Then, use stubs of those
methods instead of other units that’ll provide the necessary inputs for the unit under test.
Thus, a possible error in the other unit will not affect the unit under test.
Test cases are created according to the task performed by the unit being tested. Using these
situations, the unit test is run, and the results are compared with the expected results to decide
whether the tests were successful or not.
{
if(k<0)
return true;
else(k>0)
return false;
To test this method, the cases where the k value is tested by first giving values less than 0 and then
greater than 0 are shown:
int m = 3;
td1 = isitPositive(m);
if(tc1 == true)
else
int m = 4;
tc2 = isitPositive(m);
if(tc2 == false)
else
[Link]("Test Case 2: Fail");
Integration Tests
After successfully concluding unit tests in software projects, integration tests begin. Although unit
tests serve to verify that the individual modules perform their expected functions, integration tests
aim to verify that the components in an integrated software work in harmony with each other.
In tests, both positive and negative test cases use the appropriate parameters. Then, the results are
compared with the expected values to verify that the system performs the expected behavior.
Integration tests can use different strategies, including big bang, bottom-up, or top-down.
In this strategy, since the tests involve considering the system as a whole, performing them is fast
and saves time. However, it’s difficult to determine at which level layer or from which module an
error occurs.
Then, lower-level modules that successfully complete unit tests are integrated with each other.
After this, integration tests are performed on low-level modules.
Following the successful completion of these tests, a system of upper-layer modules is integrated,
and the necessary integration tests are performed. This integration continues until the whole
system is built and the integration tests are completed successfully.
In this approach, the basic condition is that the unit tests of the modules to be integrated are
successfully completed. This approach can help easily determine how much of the targeted system
is completed and tested, represented as a percentage.
Bottom-up diagram
Top-Down Strategy
The top-down integration testing strategy starts with testing the top module (the outermost
module, usually the user GUI module) for the system. This module uses the stubs of the required
submodules.
Top-down diagram
The number of test cases run reaching a certain rate or passing all of them indicates completed
integration tests. Engineers should report errors found at this stage to software developers
according to a defined error-reporting mechanism.
System Tests
System tests evaluate the developed software’s features including performance, reliability, and
functionality. It’s verified that the software developed in unit tests and integration tests is
developed in accordance with the design.
On the other hand, system tests aim to verify what the customer wants from the system. For this
reason, in system test cases, scenarios encountered in the real environment are defined based on
the system requirements.
Steps
The first step of system testing is verifying the functional requirements performed. As a result of
this verification, engineers can see that the system works functionally. After verifying
functionality, they perform non-functional tests.
Nonfunctional Tests
stress tests—These tests help observe the system’s behavior when the input rate to the
system exceeds the system design rate.
performance tests—These tests evaluate whether the system outputs can be produced
within the specified and acceptable time frame.
configuration and compatibility tests—These tests evaluate how the developed system
behaves on different platforms and hardware.
security tests—These tests evaluate the system’s behavior in unauthorized use attempts.
usability tests—These tests evaluate user-system interaction and ergonomics.
rollback tests—These tests evaluate the system’s automatic or manual recovery in the
event of a failure.
user interface tests—These tests evaluate how the user and the software will interact as a
graphical representation, and how the system will process the inputs that the user will give
to the system with the keyboard, screen, or mouse (i.e., the touchpad).
The system that has its nonfunctional tests completed is now ready for user acceptance tests. Errors
that occur during system tests are reported according to the project error management process, and
necessary corrections are made.
After the necessary fixes, the system undergoes iterative tests to evaluate that the fixes did not
affect the rest of the system.
Acceptance Tests
For this purpose, test cases serve to validate each user requirement. In the developed system, these
defined test cases are applied in accordance with the “acceptance test plan” with the customer’s
participation.
To sum up, after the entire system passes these tests, the customer can accept the system.
Conclusion
To summarize, we’ve highlighted how important test case design is. Software testing becomes
much more important in very large projects because a product on the market that is constantly
causing problems due to malfunctions causes a great loss of time and money.
For example, test engineers with good theoretical knowledge are very important for projects that
have an important place in software technologies such as banking software, military software,
public software, and games.
To that end, the need for good testers and good coders increases day by day.
Result:
Thus, the test plan and test case has been developed and designed for the inventory
management system.
Ex. No. 5 Execute the test cases against a client server or desktop application and identify
Date: the defects
Aim:
To execute the test cases against a client server or desktop application to identify the defects.
Client Server
The Client-Server application consists of two systems, one is the Client and the other is the Server.
Here, the client and server interact with each other over the computer network.
In Client-Server application testing, the client sends requests to the server for specific information
and the server sends the response back to the client with the requested information. Hence, this
testing is also known as two-tier application testing.
This type of testing is usually done for 2 tier applications (usually developed for LAN). We will
be having Front-end and Backend here.
Applications launched on the front-end will have forms and reports which will be monitoring and
manipulating data.
GUI Testing (UI Testing)
Functional Testing
Manual Testing
Configuration Testing
Load Testing (Back-end Testing)
Performance Testing
Interoperability Testing
Compatibility Testing (Software/Hardware)
Merits & Demerits
Merits:
All the data is located at the central location (Server), hence data is protected
easily by providing access to authorized users.
Data can be accessed efficiently even if the server is located away from the
clients.
Demerits:
If multiple clients send requests to the same server in parallel, it leads to
congestion in the network because the server may get overloaded.
Due to any reason, if a server fails then none of the client requests can be fulfilled
and this leads to the disruption of the client-server network.
The cost of setting up and maintaining the server is high.
What Is Web Testing?
Testing Web Applications is a bit different and complicated when compared with Desktop
Application testing and Client-Server application Testing.
As the name hints, any application which is accessed over the internet through a browser is known
as a web application. Testing performed on these applications is known as Web Application
testing. Web Applications are launched using a URL in a browser. Web testing is performed on
different browsers and in different operating systems.
Here browser sends the request to the web server and the web server sends the same request to the
database and the database sends the response to the web server and the web server redirects the
same response to the browser. Hence, this is also known as three-tier application testing.
The picture below depicts what the Web application looks like:
This is done for 3 tier applications (developed for Internet/intranet/xtranet). Here we will be
having Browser, web server and DB server.
The applications accessible in the browser would be developed in HTML, DHTML, XML,
JavaScript, etc. (We can monitor through these applications).
Applications for the webserver will be developed in Java, ASP, JSP, VBScript, JavaScript, Perl,
Cold Fusion, PHP, etc. (All the manipulations are done on the webserver with the help of these
programs developed)
The DB server would have Oracle, SQL Server, Sybase, MySQL, etc. (All data is stored in the
database available on the DB server).
Characteristics:
Few desktop applications are MS-Office, Calculator, Adobe Acrobat Reader, etc.
The image below depicts what the desktop application looks like:
Characteristics
These applications are highly-developed to execute the applications on particular
operating systems.
No internet connectivity is required to work on desktop applications.
Types of Testing to perform
Below are the different testing techniques to be performed:
Usability Testing
Functional Testing
Load Testing (Back-end Testing)
Performance Testing
Security Testing
Regression Testing
Compatibility Testing (Software/Hardware)
Merits & Demerits
Merits:
Doesn’t require any internet connection.
Can be accessed very quickly.
Hacking these applications is impossible because of high security.
Demerits:
Confined to only one user to access the desktop application at a time.
It is not possible to share the data.
High maintenance is required as these applications need some storage to install.
Difference Between Desktop, Client-Server, And Web Application Testing
Desktop Application:
Application runs in single memory (Front end and Back end in one place)
Single user only
Client/Server Application:
Applications run in two or more machines.
Applications are menu-driven.
Connected mode (connection always exists until logout).
A limited number of users.
Less number of network issues when compared to the web app.
Web Application:
Applications run in two or more machines.
URL-driven
Disconnected mode (stateless)
Unlimited number of users.
Many issues like Hardware Compatibility, Browser Compatibility, Version
Compatibility, Security Issues, Performance Issues, etc.
As per the difference in both, the applications come from where and how to access the resources.
In Client-Server, once the connection is made, it will be in the state on connected, whereas in case
the web testing HTTP protocol is stateless, then there comes logic of cookies, which is not in
Client-Server.
For Client-Server application, users are well known, whereas for web application any user can log
in and access the content, he/she will use it as per his intentions.
Result:
Thus the test cases against a client server or desktop application and to identify the defects has
been developed and executed successfully.
Ex. No. 6
Date: Test the performance of the e-commerce application
Aim:
To test the performance of the e-commerce application.
Procedure:
The importance of offering a great customer experience cannot be overstated. That is why retailers
must take the proper steps to test their websites and applications especially when it comes to
providing a consistent and stable online experience during peak sales periods.
In order to assess an application’s scalability, speed, and stability, there are a number of different
performance tests that QA teams should consider. Executing these tests is the best way to measure
the performance of an e-commerce application or website from a variety of angles.
Volume Testing: Gauges the application’s throughput by using a large amount of data in
search workflows.
In e-commerce, the performance-testing plan should also incorporate a number of elements that
can affect the speed and scalability of websites and applications.
For retailers with an international customer base, performance tests should be carried out to ensure
the geographical location of online shoppers does not affect the speed of the site or application.
The point here is to make sure customers in the United States experience the same response time
as customers in France or Japan.
Because some transactions, like product searches, can be more network intensive than others,
testing all transactions is critical. At the same time, transactions need to be tested across different
devices and browsers to make sure the transaction speed is up to par.
In addition, it is crucial to recognize that online shoppers do not all have the same profile and nor
exhibit the same behaviors or tendencies. In fact, it is very common for shoppers to take several
different paths while shopping online. As a result, QA teams must pay careful attention to testing
every user path possible to measure its impact on the application’s architecture.
Today’s online consumer uses multiple devices before ultimately making a purchase, whether in-
store or online. To offer an optimal user experience, it is vital for performance tests to account for
the different devices (laptop, tablet, and smartphone) that consumers use to shop online.
Additionally, using different browsers, operating systems, smartphone or tablet models, etc., is
essential to determine if certain configurations negatively affect the performance of an application
or a website.
E-commerce websites and applications need to be able to handle multiple transactions at the same
time. Testing payment systems is critical step in the QA process, and should not be skipped for
any reason. Testing the performance of payment systems will help the QA team uncover any issues
that can disrupt or block transactions, especially when a large number of users checkout at the
same time.
When it comes to third-party payment gateways, it is important note that testing can be a bit more
challenging. This is because most payment gateways providers do not provide a favorable testing
environment. While this may sound unreasonable, it is a way for payment gateway providers to
prevent their portals from being flooded with tons of virtual users.
Using a sandbox environment, QA teams can overcome this challenge in creating a safe testing
environment in order to test key scenarios on an application or site with a fully integrated payment
gateway.
As online sales continue to grow and represent an important channel for retailers, performance
testing will continue to enable them to deliver high quality applications and sites. For help
planning or executing effective performance tests, do not hesitate to contact us.
Result:
Thus the performance procedure of the e-commerce application has been developed
successfully.
Ex. No. 7 Automate the testing of e-commerce applications using Selenium
Date:
Aim:
To automate the testing of e-commerce application using Selenium.
Procedure:
1. What should you know before automating this automation assignment?
You should know the following topics, before starting this project assignment:
• Software Testing Concepts
• Core Java Concepts
• Locators and Find Element Commands
• Selenium Webdriver Commands
• Actions Class Commands
• Selenium Wait Commands
2. Which functionalities will we automate in this project assignment?
We will learn to automate multiple test scenarios of an e-commerce website in this project like:
Is the website having multiple filters to search products like., price range, category,
brands, etc.?
Are relevant Products displaying after applying single or multiple search filters?
Is there an option to display a fixed number of products on the search page?
Is there any sort option available on the search page and is that working properly?
Is the correct price getting displayed in the shopping cart for the selected product/s?
Is there an option to apply coupon codes?
Can a user increase or decrease the quantity of a product from the shopping cart?
Can a user remove the product from the shopping cart?
Testing the Checkout Flow and Order Confirmation of the Online shopping website
Does the user able to enter shipping and billing information or is it auto-filled, if the user
already saved it?
Are all the supported payment methods working?
Is the user's sensitive information handled securely, like credit/debit card info, address,
bank details etc?
Is the user receives an email or sms on order confirmation?
Can the user track the order?
[Link] the 'User Registration and Login' of Amazon like an e-commerce website
This section is focused on covering all the scenarios for User Registration for an e-commerce
website. In this assignment, you will learn the different Selenium commands which are used to
handle the web form. A web form is generally a collection of web elements like text boxes, radio
buttons, selection boxes, etc. And in web testing, we mostly face web forms and 90% of testing
revolves around web forms. We are going to cover both positive and negative scenarios for User
Registration.
Positive Scenarios:
Test Case - Automate the User Registration process of an e-commerce website.
Steps to Automate:
1. Open this URL [Link]
2. Click on the sign-in link.
3. Enter your email address in the 'Create and Account' section.
4. Click on Create an Account button.
5. Enter your Personal Information, Address, and Contact info.
6. Click on the Register button.
7. Validate that the user is created.
This code is contributed by Uday. We have provided the code for only positive scenarios, you
should try automating negative scenarios yourself.
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
[Link](URL);
[Link]().timeouts().implicitlyWait(2000, [Link]);
[Link]().window().maximize();
//Click on Sign in
[Link]([Link]("Sign in")).click();
//Select Title
[Link]([Link]("//input[@id=\"id_gender1\"]")).click();
[Link]([Link]("customer_firstname")).sendKeys("Test User");
[Link]([Link]("customer_lastname")).sendKeys("Vsoft");
[Link]([Link]("passwd")).sendKeys("PKR@PKR");
// Select State
WebElement statedropdown=[Link]([Link]("id_state"));
Select oSelect=new Select(statedropdown);
[Link]("4");
[Link]([Link]("postcode")).sendKeys("51838");
// Select Country
WebElement countrydropDown=[Link]([Link]("id_country"));
Select oSelectC=new Select(countrydropDown);
[Link]("United States");
Negative Scenarios
Test Case - Verify invalid email address error.
Steps to Automate:
1. Open this URL [Link]
2. Click on the sign-in link.
3. Enter an invalid email address in the email box and click enter.
4. Validate that an error message is displaying saying "Invalid email address."
Test Case - Verify error messages for entering incorrect values in fields.
Steps to Automate:
1. Open this URL [Link]
2. Click on the sign-in link.
3. Enter your email address and click the Register button.
4. Enter incorrect values in fields like., enter numbers in first and last name, city field, etc., and
enter alphabets in Mobile no, Zip postal code, etc., and click on the 'Register' button.
5. Verify that error messages for respective fields are displaying.
Try automating the above scenarios using Selenium commands, if you face any difficulty please
refer to the Selenium Tutorial series.
Test Case - Automate the 'Search Product' feature of the e-commerce website with
Selenium.
Steps to Automate:
1. Open link [Link]
2. Move your cursor over the Women's link.
3. Click on the sub-menu 'T-shirts'
4. Get the Name/Text of the first product displayed on the page.
5. Now enter the same product name in the search bar present at the top of the page and click the
search button.
6. Validate that the same product is displayed on the searched page with the same details which
were displayed on T-Shirt's page.
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
[Link]().setup();
WebDriver driver=new ChromeDriver();
String URL="[Link]
[Link](URL);
[Link]().window().maximize();
5. Automate the 'Buy Product' feature of Amazon like an e-commerce website with Selenium
The most important function of an e-commerce website is buying a product, which includes
various steps like selecting a product, selecting size/color, adding to the cart, checkout, etc. You
will find every test scenario along with the automation code in the following section.
Test Case - Automate the end-to-end "Buy Product" feature of the e-commerce website.
Steps to Automate:
1. Open link [Link]
2. log in to the website.
3. Move your cursor over the Women's link.
4. Click on the sub-menu 'T-shirts'.
5. Mouse hover on the second product displayed.
6. 'More' button will be displayed, click on the 'More' button.
7. Increase quantity to 2.
8. Select size 'L'
9. Select color.
10. Click the 'Add to Cart' button.
11. Click the 'Proceed to checkout' button.
12. Complete the buy order process till payment.
13. Make sure that the Product is ordered.
import [Link];
[Link]().setup();
WebDriver driver=new ChromeDriver();
String URL="[Link]
//Click on Sign in
[Link]([Link]("Sign in")).click();
//Login
[Link]([Link]("email")).sendKeys("test1249@[Link]");
[Link]([Link]("passwd")).sendKeys("PKR@PKR");
[Link]([Link]("SubmitLogin")).click();
//Click on Women
[Link]([Link]("WOMEN")).click();
WebElement
SecondImg=[Link]([Link]("/html/body/div[1]/div[2]/div/div[3]/div[2]/ul/li[2]/di
v/div[1]/div/a[1]/img"));
WebElement
MoreBtn=[Link]([Link]("/html/body[1]/div[1]/div[2]/div[1]/div[3]/div[2]/ul/li[2]
/div[1]/div[2]/div[2]/a[2]"));
Actions actions=new Actions(driver);
[Link](SecondImg).moveToElement(MoreBtn).click().perform();
//Change quantity by 2
[Link]([Link]("quantity_wanted")).clear();
[Link]([Link]("quantity_wanted")).sendKeys("2");
//Select size as L
WebElement Sizedrpdwn=[Link]([Link]("//*[@id='group_1']"));
Select oSelect=new Select(Sizedrpdwn);
[Link]("M");
//Select Color
[Link]([Link]("color_11")).click();
//Click on proceed
[Link]([Link]("/html//div[@id='layer_cart']//a[@title='Proceed to
checkout']/span")).click();
//Checkout page Proceed
[Link]([Link]("/html/body/div[1]/div[2]/div/div[3]/div/p[2]/a[1]/span")).click();
[Link]([Link]("/html/body/div[1]/div[2]/div/div[3]/div/form/p/button/span")).clic
k();
//Agree terms&Conditions
[Link]([Link]("//*[@id=\"cgv\"]")).click();
[Link]([Link]("/html/body/div[1]/div[2]/div/div[3]/div/div/form/p/button/span")).
click();
[Link]([Link]("/html/body/div[1]/div[2]/div/div[3]/div/div/div[3]/div[2]/div/p/a")
).click();
//Confirm the order
[Link]([Link]("/html/body/div[1]/div[2]/div/div[3]/div/form/p/button/span")).clic
k();
//Get Text
String
ConfirmationText=[Link]([Link]("//div[@id='center_column']/p[@class='alert
alert-success']")).getText();
}
}
You should try automating the below-mentioned scenarios yourself for your practice. You can
also send your code to us via email or post in the comment section, we would be happy to share
your hard work on our website with your credentials.
Test Case - Verify that 'Add to Wishlist' only works after login.
Steps to Automate:
1. Open link [Link]
2. Move your cursor over the Women's link.
3. Click on the sub-menu 'T-shirts'.
4. Mouse hover on the second product displayed.
5. 'Add to Wishlist' will appear on the bottom of that product, click on it.
6. Verify that the error message is displayed 'You must be logged in to manage your wish list.'
Test Case - Verify that Total Price is reflecting correctly if the user changes quantity on
the 'Shopping Cart Summary' Page.
Steps to Automate:
1. Open link [Link]
2. Log in to the website.
3. Move your cursor over the Women's link.
4. Click on the sub-menu 'T-shirts'.
5. Mouse hover on the second product displayed.
6. 'More' button will be displayed, click on the 'More' button.
7. Make sure the quantity is set to 1.
8. Select size 'M'
9. Select the color of your choice.
10. Click the 'Add to Cart' button.
11. Click the 'Proceed to checkout' button.
12. Change the quantity to 2.
13. Verify that the Total price is changing and reflecting the correct price.
Result:
Thus the automation of e-commerce application using Selenium has been written, executed and
verified successfully.
Ex No. 8 Integrate testNG with selenium automation
Date:
Aim:
To integrate testNG with selenium automation.
Implementation Steps:
1. Download and Install Java on the system
2. Download and setup Eclipse IDE on the system
3. Setup Maven
4. Create a new Maven Project
5. Add Selenium and TestNG dependencies to the project
6. Create a Test file under src/test/java
7. Run the tests from [Link]
8. TestNG Report Generation
Step 1- Download and Install Java
Selenium needs Java to be installed on the system to run the tests. Click here to know How to
install Java.
Step 2 – Download and setup Eclipse IDE on the system
The Eclipse IDE (integrated development environment) provides strong support for Java
developers, which is needed to write Java code. Click here to know How to install Eclipse.
Step 3 – Setup Maven
To build a test framework, we need to add a number of dependencies to the project. It is a very
tedious and cumbersome process to add each dependency manually. So, to overcome this
problem, we use a build management tool. Maven is a build management tool that is used to
define project structure, dependencies, build, and test management. Click here to know How to
install Maven.
Step 4 – Create a new Maven Project
Click here to know How to create a Maven project
Below is the Maven project structure. Here,
Group Id – [Link]
Artifact Id – Selenium_TestNGDemo
Version – 0.0.1-SNAPSHOT
Package – com. example. Selenium_TestNGDemo
TestNG also produces an “[Link]” report, and it resides under the test-output folder. The
below image shows the [Link] report. This is the latest theme of the report.
The links present on the left side are clickable. I have clicked the Times link, and you can see
the details on the right side.
Result:
Thus the steps to integrate TestNG with the automation of Selenium has been written, executed
and verified successfully.