December 22, 2015

Automate Amazon: Development Environment Setup

This post is first in a series of nine.

Back in June 2015, I blogged about how I would write automated tests vs Dave Haeffner's site, "The-Internet".

For this second project, I picked a more difficult site to automate: Puchasing an order on Amazon.com's site.



Please note: I haven't been doing automation on-the-job for very long. I have less than a year's worth of experience developing automated tests in Selenium WebDriver. Please don't take anything that I am doing as the industry standard.


If you do have knowledge of the industry standard of automated testing, please feel free to correct me! I will be eagerly monitoring the comments section for any advice or wisdom.

Setting Up the Development Environment


For this project I am using:
  • Platform and Operating System: Windows 10.
  • Integrated Development Environment (IDE): IntelliJ. Although we use the Enterprise Edition at work, the only difference between that and the free Community version is extra features for database integration.  
  • Test Framework: TestNG. It is built into the latest version of IntelliJ, but you still need to set up the dependencies in your pom.xml file.
  • Dependencies Management: Even though at work we use Gradle, for this project I am using Maven to add Selenium WebDriver and TestNG as dependencies. 
  • Browsers: Both at work and at home to inspect page elements, I use the Firefox browser plugins Firebug and Firepath to examine the web document.

If you need help getting IntelliJ, setting up Maven, setting up your pom.xml file or TestNG, or installing Firefox, Firebug or Firepath, there is a free introduction on Alan Richardson's page, Start Using Selenium WebDriver at http://seleniumsimplified.com/get-started/.

If you are looking for more material, Alan Richardson has an extensive course on Selenium 2 WebDriver with Java at http://courses.compendiumdev.co.uk/courses/selenium-2-webdriver-with-java which helped me immensely preparing for my current position.

Make sure to go to the official SeleniumHQ site at http://docs.seleniumhq.org/docs/ or visit their new documentation that is still in progress at https://seleniumhq.github.io/docs/.

If it helps, below is a sample of my POM.xml file.

<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0"         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.tjmaher.selenium</groupId>
    <artifactId>com.tjmaher.selenium</artifactId>
    <version>1.0-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.48.2</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.1.1</version>
        </dependency>
    </dependencies>

</project>



Run Your First Test

Let's name the test class PurchaseOrderTest.java.

The @BeforeClass method contains the setUp information that launches the browser.
The @AfterClass method contains the tearDown information that closes the browser.

They will be executed respectively before the class PurchaseOrderTest, then after the class is done.





When you run PurchaseOrderTest:

  • The Firefox browser opens up
  • It navigates to Amazon.com
  • The Firefox browser closes.



Now that we know that tests can be run, with the next installment of this blog, we can sketch out a quick test.

-T.J. Maher
 Sr. QA Engineer, Fitbit
 Boston, MA

// Automated tester for [ 8 ] month and counting!

Please note: 'Adventures in Automation' is a personal blog about automated testing. It is not an official blog of Fitbit.com



16 comments:

Anonymous said...

Thanks, Experience with various technologies and businesses this is generally helpful.
Still, I followed step-by-step your method in this selenium training
selenium certification
selenium online training Hyderabad
selenium online courses

Keerthi55 said...

data science training
python training
angular js training
selenium trainings
sql server dba training

Roger Arin said...

Thanks for sharing this post and the efforts you have made in writing this. Good to see such nice articulated post!!
Thanks for sharing this blog!!
nh623m paint gallon

Keerthi55 said...

selenium online trainings
selenium online trainings from India

Assignment Writing Help said...

We are a top rated marketing assignment help Online service here with experts specializing in a wide range of disciplines ensuring you get the assignments that score maximum grades.

vaibhav said...

Thanks for sharing this wonderful article with us. Your post is really good. If you are looking the best assignment help service then kindly visit our website Cheapassignmenthelp.co.uk. For more information kindly check below links:
Marketing Management Assignment Help Uk
HND Diploma & Advance Diploma in Construction Management
HND Warehousing Management
HND Diploma in Web Design
HND Diploma in Digital Marketing
HND Diploma in Project Management
HND Diploma in Entrepreneurship
HND Diploma In Pre U Foundation Studies
HND Diploma In Law
Case Study Assignment Help UK
Law Contract Assignment Help Uk
HND Diploma in Digital Marketing
New Graduate Application Assignment Help Uk
Case Study Assignment Help UK
Taxation Theory Law Assignment Help UK
Financial Analysis Coca COla Amatil Assignment Help Uk
Strategic Information Systems Business Assignment Help Uk
Market structure Absolut vodka Nepal Assignment Help Uk
Business Scenario Stitches Assignment Help Uk
New Graduate Application Assignment Help Uk

Isabell Kiral said...

This platform is very much beneficial for us because through this, we can earn a lot of money by doing work from home. Many professionals have joined this field and they are satisfied. Assignment writing services.

Help in Homework said...

Academic life is so much more than looking for academic assignment help. As this is a growing time for students, literally and figuratively, students should indulge in more than academics. They should put some time aside for sports, music, or anything that interests them.You can leave your assignments and homework in the care of our experts at Help in Homework. They will complete all your academic assignments and homework at the most reasonable rate and undoubtedly help you fetch the top scores.

Rian said...

event marketing a generation of professional online content creators on these platforms have largely already cracked the code on delivering sponsor ROI to an audience trained to bypass any advertising they can opt out of good morning prayer, ice puns and cow puns.

oncasinosite said...

Hey there. I found your site by the use of Google whilst looking for a similar subject, your site came up. It looks good. I have bookmarked it in my google bookmarks to visit then. Also visit my website: 온라인카지노사이트

casinositelink said...

It is perfect time to make some plans for the future and it is time to be happy. I have read this post and if I could I want to suggest you some interesting things or advice. Maybe you can write next articles referring to this article. I want to read even more things about it Also visit my website: 카지노사이트링크

oncasinositenet said...

it’s really a nice and useful piece of information. I’m happy that you simply shared this helpful information with us. Please keep us informed like this. Thank you for sharing. Also visit my website: 온라인카지노사이트넷

bacarasite said...

This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here keep up the good work Also visit my website: 바카라사이트닷컴

Anonymous said...

I must admit that your post is really interesting. I have spent a lot of my spare time reading your content. Thank you a lot! click here

vé máy bay từ canada về việt nam said...

Mua vé tại đại lý vé máy bay Aivivu, tham khảo

gia ve may bay di my

chuyến bay từ mỹ về việt nam tháng 1/2021

đăng ký bay từ canada về Việt Nam

mua vé từ nhật về việt nam

giá vé máy bay từ hàn quốc về việt nam

Vé máy bay từ Đài Loan về VN

Chuyen bay cho chuyen gia nuoc ngoai

lordwilliam said...

assignment answers online: You can now buy you assignment online, made by expert writers with professional experience in the field!.