December 24, 2015

Automate Amazon: Sketch out a Use Case

This post is second of a series of nine. Need to go back to the beginning?

With the last blog entry, we talked about setting up a development environment and running our first test.

With this entry, we are going to examine Amazon.com's site and see if we can come up with a quick test to automate creating a purchase order with Amazon's Sign In, AddToCart and Checkout process.


Draft the Test

Go to the Sign In Page


The SignInPage is where we Sign into the site, entering the email address and password into the appropriate text boxes, and select the "Sign in" button. We need to:

  • Go to http://www.amazon.com/
  • Mouseover to "Hello. Sign in Your Account"
  • Select the "Sign In" button

Sign Into the Site

  • At the Sign In page enter the test user name and password.
  • Log into the site.

Select a Test Project


For an initial test product in the Purchase Order test, let's use a Mass Market Paperback copy of The Hitchhiker's Guide to the Galaxy, by Douglas Adams. This is the first book in the four book "Hitchhiker trilogy", re-released by Del Ray in 1995.

You can find the Amazon link to the book at http://www.amazon.com/gp/product/0345391802


Besides a lot of absurdist and excellent nerdy humor, this test product has many properties.

  • ProductTitle: The Hitchhiker's Guide to the Galaxy
  • Author: Douglas Adams
  • OfferPrice: $7.19
  • Edition: Mass Market Paperback

While we add this book to the cart and checkout with it -- as much as we can do without any test credit cards -- we will be attempting to verify at each stage that these four properties stay the same.

Now, let's walk through the site, seeing what happens when we add this book to the cart.

ProductPage


First, let's come up with some more proper names we can use.

  • Let's call http://www.amazon.com/ the HomePage, and the url the baseURL.
  • Since the subfolder is /product/ let's call this section the ProductPage. 
  • Since the suffix for the URL is 0345391802, let's call this the productID
  • So, to get to this specific URL it is baseURL + productPage + productID.

Now, let's select the [AddToCart] button.

ShoppingCartPage 


Here, we can verify that the properties on the ProductPage carried over to the ShoppingCart page:
  • ProductTitle: The Hitchhiker's Guide to the Galaxy
  • Author: Douglas Adams
  • OfferPrice: $7.19
  • Edition: Mass Market Paperback
... Since we don't have any test credit cards, let's skip placing your order and end the test here.

Components of the Test

The test methods can go in the package testcases in a class called PurchaseOrderTest.java.

From our sketch, it looks like we can collect the web elements in the package pages into the following Page Objects:

  • HomePage
  • SignInPage
  • ProductPage
  • ShoppingCartPage

The individual page objects would be Java classes that only contained encapsulate getting, setting, and validating the web elements.

We could do the extra step of grouping up common elements of the test such as the steps to sign into Amazon.com in an actions package in a class called PurchaseOrderActions.java.


View the (mostly) Completed Test Code:


NEXT: Setting up Common Utility Methods >>

-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





19 comments:

Oliver said...

This is great, I think you can help me create a use case for my Nursing assignment too, or at least provide me some Nursing assignment help UK so that I can understand the logics and create the assignment on my own.

jeffreyjonathan411 said...

Yes, you are right I agree with you you can hire the best assignment writer in the UK to do your assignments & homework. We have the best writers online dissertation writing services if you need help with your assignments so contact.

John said...

Well, to be honest, I have not read it entirely but I think it is related to the website because here is the content that can be used to create a website. Anyways, I have saved this post and will visit it immediately after finding business management assignment help service to complete my assignment.

unknown said...

Taking online service is a new trend for getting over the academic burden for students. I have also tried the UK Essay Writers services once which turned as the best help for all of my assignment writing troubles. Because it took off all of the extra pressure and provided great ease in assignment submission.

IngaVelington said...


If you're struggling with a math homework help https://essayservice.com/math-homework-help, it's important to seek out a tutor who is experienced in this subject. This way, you can rest assured that you're not the only one in need of assistance. It's important to find a tutor who can explain complex concepts in simple terms. You need someone who can understand physics in depth and can break things down for you.

studyfy.com said...

hello everyone! I've been having some problems recently. I couldn't write an essay, I was bored, lazy and didn't want to do it. I was having a really hard time with essays. But one day, I was helped by the Essay writing service here it is studyfy.com . Since then, I don't write essays anymore and all my free time goes to my favorite activities. I also have no problems at school, and my teachers respect me!

Jessica Carvin said...

As a Top Web Developer, I can see how automating Amazon could be incredibly valuable for businesses and consumers alike. One potential use case that comes to mind is automating the product purchasing process.

Imagine being able to create a script that automatically purchases products from Amazon based on certain criteria. For example, you could set up the script to purchase a certain product when it drops below a certain price, or when it goes on sale. This could be incredibly useful for businesses that need to purchase large quantities of products on a regular basis, as it would save them time and effort.

Aaron Reed said...

When seeking a paper writer https://writer24.com/paper-writer , several key factors should guide your decision. Start by reading online reviews to gauge their credibility. The writer you select should possess relevant academic qualifications and demonstrate expertise in your paper's subject matter. While affordability is important, the cheapest options may not always provide the best quality. Strive to find a balance between cost and quality. Timeliness is also a crucial consideration, particularly if you're dealing with strict deadlines. Choose a writer who is responsive and readily available to address any concerns or make revisions promptly. Ultimately, thorough research and careful selection are the keys to finding a competent writer.

arthor said...

I wish to express my genuine gratitude to the creative force behind this blog. Your unwavering dedication and hard work truly shine and are profoundly valued. The consistently perceptive content you produce is a testament to your resolute commitment. I am eagerly looking forward to immersing myself in more of your captivating articles. Your exceptional efforts undoubtedly deserve recognition and a heartfelt recommendation.Multa Conducción Imprudente Nueva Jersey

Tara said...

"The Hitchhiker's Guide to the Galaxy" is a whimsical and satirical science fiction series created by Douglas Adams. It follows the misadventures of Arthur Dent, an unwitting Earthman, as he travels through space with his alien friend Ford Prefect and explores the absurdities of the universe with the help of the titular guidebook.
Abogado Conducción Imprudente New Kent VA




Chris Mark said...

I think automating Amazon could revolutionize their supply chain management. Imagine a use case where AI-driven predictive analytics help optimize inventory levels, reducing costs and ensuring products are always in stock. This could also streamline their accounting processes, making accounting assignment help more accessible to sellers looking for financial assistance. Automating the financial side of things would truly enhance the Amazon experience for sellers and buyers alike.

john said...

katana-based NFT PC games to play in 2020. In "Sekiro", players take on the role of a one-armed shinobi named Sekiro as he seeks revenge against a powerful samurai who crippled him.

Mason Dale said...

Creating an efficient Amazon automation store is pivotal in today's dynamic e-commerce landscape. Sketching out a use case highlights the immense potential of streamlining operations, optimizing inventory management, and boosting sales. Embracing automation in the Amazon store is key to staying competitive and scaling effectively.

Tara said...

Automate Amazon Sketch Out Use Case streamlines the e-commerce process by employing cutting-edge automation tools. Enhancing efficiency, it automates tasks like inventory management, order processing, and customer communication. This innovative solution optimizes Amazon seller workflows, reducing manual efforts and enhancing overall productivity for a seamless and scalable online retail experience.uncontested divorce in virginia beach






victoriya said...

. Our legal team is prepared to help you navigate the emotional landscape by focusing on complete assistance, resolving relevant legal matters, and taking a results-driven approach. This will guarantee that your legal representation is thorough, knowledgeable, and well-positioned in Fairfax.Fairfax Grounds for Divorce Lawyer

it company said...


Comfort is another key attribute that often surprises guests staying in Guest house in karachi The rooms are tastefully decorated, creating an ambiance of tranquility and relaxation. The cozy beds, soft pillows, and quality linens ensure a good night's sleep, while the well-appointed furniture and modern amenities contribute to a comfortable stay. Whether you choose a room with a magnificent view of the city or a serene garden, guest houses in Karachi ensure that your every need is met.

buttlerjoy said...

Pakistan's knitwear manufacturers offer a diverse range of products, catering to various consumer needs and preferences. From basic everyday wear to fashionable and trendy outfits, these manufacturers produce an array of knitted garments.

Anonymous said...

Thank you for this fantastic post.prince william county criminal attorney

Amy Jhons said...

orange county family law lawyerOrange County family law lawyers specialize in navigating the intricate legal terrain of familial matters within the jurisdiction. These legal experts offer counsel and representation in cases including divorce, child custody, alimony, adoption, and domestic violence. With profound understanding of California family law and local court intricacies, they advocate for their clients' rights and facilitate resolutions that prioritize familial well-being. Orange County family law lawyers provide compassionate support and strategic guidance, ensuring the best possible outcomes for families in transition.