Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Evil Tester: How to Use Your Testing Skills to Bag a SNES Classic Mini Pre-Order

DZone's Guide to

Evil Tester: How to Use Your Testing Skills to Bag a SNES Classic Mini Pre-Order

You probably use your testing skills for a variety of tasks, but have you ever used them to get your hands on a Super Nintendo?

· DevOps Zone
Free Resource

Learn more about how CareerBuilder was able to resolve customer issues 5x faster by using Scalyr, the fastest log management tool on the market. 

At the moment Nintendo has initiated a voluntary viral distributed denial of service attack which hits retailers on demand. Every time a retailer announces pre-order availability of a SNES Mini Classic they are hit by 1000s (100,000s?) of people simultaneously trying to buy the product.

Thus far this week, I have seen it destroy the Game website entirely, and on Argos, I received the Red Circle of Ajax Doom when trying to add the SNES Classic Mini Console to my basket.

But I was ready for this.

And you can be too.

In this post, I’ll describe how to use your testing skills to pre-order a SNES Classic Mini, or at the very least, how to monitor websites automatically, and why API, mobile, and GUI apps can differ.

Failure Driven

I failed to manage to pre-order earlier in the week from Game, Amazon, or Nintendo because:

  • I always received notification of the pre-order availability too late.

I arrived either when it was sold out, or when the site was crashing and burning under the load.

Put your Tester hat on now. What do you need to do?

  • Find a way of receiving announcements instantly.
    • But from whom? Each announcement comes from a different site.
      • Find an oracle that collates all the announcements.
      • Get notification from that oracle.

I found the TechRadar site has a page announcing the pre-orders.

I have an oracle, but no notifications.

Automated Observation

I could write a script to monitor the website and look for changes, or I could add a tool to support my observation. Since I only really want notifications when I’m at my computer and able to take advantage of the notification, I looked for a browser plugin that would monitor websites.

I installed Page Monitor, a handy Chrome plugin that will periodically monitor websites for changes, and set it up to automatically observe Tech Radar. I also set it up to monitor Amazon, Game, and Nintendo, just in case more pre-orders become available.

Avoiding False Positives

And the first thing that happened was: I received notifications within minutes…because Tech Radar has adverts and other stuff on the page that change.

I needed my alerts to be more specific.

Fortunately, Page Monitor allows you to restrict the monitoring to specific parts of the page using the advanced custom mode.

Using my Super Advanced Technical Testing abilities, I looked at the DOM and found the ID for the HTML segment I wanted to monitor, then wrote the CSS selector for that section.

#article-body

Yup, I didn’t really need super advanced technical testing abilities to figure that out. Basic HTML skills and the ability to use Browser Developer tools would have sufficed.

Woo Hoo!

Yesterday, my setup worked. I received a very quick notification for a site that had listed them, but I hadn’t used the retailer before. They looked like they were offering credit and the price was more than anyone else.

So I stopped the purchase, but I was fairly sure my notification process was working.

Today

Today Argos decided to voluntarily step up to join the Distributed Denial Of Service Attack and listed the console for pre-order on their website.

I duly added the console to my basket and received the mighty AJAX Circle of Doom.

A div showing an image that pretends something is happening, but it isn’t.

Do I give up?

No, for I have Testing Skills.

Observe More Deeply

Opening the network tab in the Development tools shows me that an XHR request is made when I try to add it to the basket, so I look to see if any information is returned.


 /*
{
 "errorCode": "CMN0420E",
 "errorMessage": "The following command exception has occurred
           during processing: \"java.lang.NullPointerException\".",
 "errorMessageKey": "_ERR_COMMAND_EXCEPTION",
 "errorMessageParam": ["java.lang.NullPointerException"],
 "correctiveActionMessage": "",
 "correlationIdentifier": "-634834g2b:62cj5372441:-57c2",
 "exceptionData": null,
 "exceptionType": "1",
 "originatingCommand": "ArgosProductPurchaseJSON",
 "systemMessage": "The following command exception has 
         occurred during processing: \"java.lang.NullPointerException\"."
}
*/

Yeah, that doesn’t look good. I guess the Argos backend is written using Java- but why send back a commented out error message? Very odd. I’m pretty sure the API isn’t meant to return that.

It then seems to go into an infinite series of callback requests which fail and fire another one.

Cross Browser Issue Ruled Out

This also means that I don’t try cross browser.

Very often, when something fails, particularly with an AJAX or JavaScript trigger, we have to test it cross browser because retail sites are notorious (at least in our house) for failing on Chrome, but working in Internet Explorer.

I’ve decided to discount this possibility after looking at the network traffic. If the XHR had timed out, or some other error reported, then I might have tried to purchase it on different browsers.

I Must Give Up Now

Surely I must give up now.

No.

For looking at the URL used for the AJAX request, I see it says /webapp/.

Perhaps there are other URLs for API and Mobile App? And perhaps they are on servers which have not been subjected to the same level of traffic?

We often see this, where the Web GUI has a set of backend server calls, which are different from the mobile application server calls, and which are different from the API server calls.

Often, these backends are on different servers because they have different load requirements, e.g. the website is hit more often so it needs to scale more quickly than the mobile app. *cough* take note, Argos.

When testing an application, this increases the scope of testing and makes our life more difficult. But knowing that this is how applications are often written and deployed gives us additional workarounds when interacting with the real world.

Install the Mobile App

I downloaded the Argos mobile app onto my phone and tried to order from there.

And the transaction went through smoothly.

Mostly smoothly.

I had one issue where I entered my postcode and allowed the app to prefill my address, which it did correctly, but then the app told me that the town it had entered was incorrect so I had to amend it. Other than that functional defect, the process went smoothly and I received a confirmation email suggesting that my pre-order has been successful.

And as I write this, over an hour after ordering on the mobile app, the website still provides its users with an AJAX Circle of Doom and no human readable error message that the server communication failed.

Risks

As a tester, I’m used to looking for risks, even after "success."

  • Pre-orders are notorious for being canceled. I do have a confirmation email but- pah, it isn’t worth the paper it isn’t printed on.
  • Credit card payments for pre-orders can fail at the point of delivery, resulting in a canceled pre-order.

I’m taking the risk by giving you my secrets, such that you too may experience pre-order joy, that if my pre-order fails, there are no more consoles left to pre-order because of your success.

But, see- testing skills can help you in the real world after all.

Find out more about how Scalyr built a proprietary database that does not use text indexing for their log management tool.

Topics:
devops ,testing ,automation ,monitoring

Published at DZone with permission of Alan Richardson, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}