Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Where can I find a full test automation

project with Selenium WebDriver?


21:43 Posted by Alex Siminiuc 11 Comments

You have been learning test automation with Selenium.

You went through lots of concepts and would like to see how they all work together.

Where can you find a project that uses everything you learned and more?

Here :)

What follows is a small project that I built a while ago for a job interview.

It uses many test automation concepts such as:

 page factory
 base classes
 html classes
 test listeners
 test ng assertions and fixtures
 annotations
 custom locators (javascript and jquery)
 screenshots
 saving errors in text files

The exercise consisted in automating the following test case with Java and Selenium WebDriver:

 Launch bestbuy url (www.bestbuy.ca)


 Search a product and add it to cart
 Go all the way through checkout process and place the order with invalid credit card
 Capture the error message due to invalid credit card

Before downloading the project and checking the source code, a few details about the project.

Project details

Maven project
- all dependencies are managed through the pom.xml file

Test NG
- unit testing library

Java JDK 8
- used for lambda expressions and streams

Page Factory
- pattern for creating page object and page fragment classes
- the elements of page object/fragment classes have names and locators
- names and locators are implemented using annotations
- available locator types are id, xpath, css, name and javascript
view source
print?
01 @Name("SEARCH_HEADER")
02 @FindBy(className = "main-navigation-container")
03 public class SearchHeader extends HtmlElement{
04
05 @Name("SEARCH_FIELD")
@FindBy(id
06
= "ctl00_MasterHeader_ctl00_uchead_GlobalSearchUC_TxtSearchKeyword")
07 private TextInput searchKeywordTxt;
08
09 @Name("SEARCH_BUTTON")
@FindBy(id
10
= "ctl00_MasterHeader_ctl00_uchead_GlobalSearchUC_BtnSubmitSearch")
11 private Button searchBtn;
12
13 public void search(String keyword) {
14 searchKeywordTxt.click();
15 searchKeywordTxt.clear();
16 searchKeywordTxt.sendKeys(keyword);
17 searchBtn.click();
18 }
19 }

You might also like