How to use RobotNinja to Automate WooCommerce testing
WordPress has certainly come a long way since the early days of being a quick way to setup a blog. These days, one of the hottest industries is ecommerce. Whether you’re selling physical goods, digital stuff or services, you should already be taking orders online. If you’re not, you’re losing out on a lot of business.
Being always online, with a shop always open for business, is the way to go.
WooCommerce has really been an enabler for the industry. It’s a plugin which hooks right into WordPress and delivers an online setup with a few simple clicks here and there.
Couldn’t get any simpler? Or is that only part of the story?
The thing is this, a shop which is online 24/7 is great – selling on the fly or taking bookings on your behalf.
But what happens when things go belly-up? And if you’re running a shop with a lot of moving parts, how do you make sure everything is working nicely? You obviously can’t keep making test purchases just to make sure everything is running nicely – you simply won’t have time, nor does it make sense.
That’s where automated testing for WooCommerce comes into play. This post is all about RobotNinja – a service which automates your WooCommerce shop’s testing.
Let’s get started!
Signup and hook up the RobotNinja to your store
Signing up for RobotNinja is free – once you’ve activated your account, it’s time to hook up your WooCommerce shop with RobotNinja. You’ll need to install the RobotNinja helper plugin and authenticate RobotNinja with your site.
It’s pretty simple, thanks to the step-by-step wizard and guide.
You’ll find you’ll need to enable the WordPress API if you’ve disabled for security or other reasons. Your site also needs to be on HTTPS, which given that you’re about to deploy an online shop, is advice that makes a lot of sense. If you haven’t got your HTTPS-enabled yet, do read our post, install a Let’s Encrypt certificate, or get in touch with your hosting, such that they give you the best option.
Once you’ve set up your site with RobotNinja, it’s time to start running your first tests!
To run your tests, it’s simply a question of clicking on the “Test Store” button, which will run a series of pre-defined tests to check that the standard WooCommerce functions are running correctly.
Once your first set of tests is run, you can have a look at the actual results of each test which has been run by NinjaRobot.
By default, the following tests are already in place:
- Load shop page – tries to load the shop to check whether it’s working ok
- Product Page Loads – checks whether the product page/pages are loading correctly
- Add Product To Cart – tests to see whether a product from your shop can be correctly added to the cart
- Cart Loads – ensures that the cart function is loading correctly
- Checkout Loads – checks whether you are able to load the checkout
- Guest Checkout – tests whether guest checkout is working
- Customer Login Page Loads – runs a test to determine whether the login page is working fine
- Existing Customer Login – ensures customers are able to login to the site / shop
- Checkout Payment Process – tries to run a payment to see whether any issues occur
It looks like there are more tests planned to be implemented in the future, it would probably be best to check this page out, to check the currently available tests.
Each test has a status associated with it, so you can quickly see which results require attention. By clicking on the Information icon, you can get a quick understanding of the reason for the current status of the test, so that you can take remedial action.
For example, our first few tests failed, because we were running the tests on a WooCommerce shop which did not have a shopping cart enabled. Once we enabled the shopping cart functionality, the tests started running correctly.
Using the free trial of the software, all of the above tests can be run, including the Checkout Payment process. However, once the trial period is over, you won’t be able to run the Checkout Payment process.
Besides actually getting the results on screen, an email is also sent out to the owner of the account. Once we describe the next part of the functionality of RobotNinja, you’ll see why this could prove to be very useful.
Scheduling testing of your WooCommerce shop
The very idea behind the concept of RobotNinja is the set and forget concept. Automated testing means, you can have the service actually running tests, without you having to worry about it.
That’s why the scheduling feature comes very handy.
The free plan of RobotNinja allows you to schedule tests weekly. The paid plan allows you to be much more granular, going down to daily tests too.
Testing multiple stores
If you’re running a website which is a significant or primary revenue generator, then you already know you should be setting up a good staging environment, such that you are able to test any changes to your environment.
Or maybe you run multiple local stores, each using their specific installation of WooCommerce.
RobotNinja allows you to add and test multiple stores within one account, so you can keep everything in one place. Testing multiple stores is part of the premium or paid plan of RobotNinja.
RobotNinja Features currently in BETA
As at the time of writing, RobotNinja has the Custom Selectors functionality which is in BETA. The Custom Selectors is essentially a feature to be able to support those WooCommerce customers who have customized their shop.
Since WC as a platform is highly-customizable, it is more than likely that some of the messages and texts that the automated tests look for no longer exist on the page, replaced by messages or text which are better suited for these specific customer experience. This would cause the standard RobotNinja tests to fail.
Given that these customized versions of WooCommerce also need testing, the Custom Selectors feature allows the tester to specify what content to look for to be able to mark the test as Passed.
Custom Selectors are primarily intended for those people with custom templates/templates that don’t use the default WooCommerce classes/ids for HTML elements. The Selectors allow them to change what elements RobotNinja looks for.
E.g. if the customization has changed the CSS classes for the Place Order button, the automated test won’t know what button to click. By changing the selector, the test would know what buttons need to be clicked.
You can specify that the test looks at one of the following:
- Name: Targets an HTML element with specific name= attribute. For example, the default “My Account” login form username field has a name=”username” attribute.
- Class: Looks for an HTML element with a specific CSS class. The default “Add to cart” button has the single_add_to_cart_button CSS class associated with it.
- ID: Targets an HTML element with a specific id= attribute. The standard “Place order” button has the place_order ID.
- Tag: You can target a specific HTML elements/tag. For example, you can target variation <option> tags.
- XPath: You can use XML Path Language to specific select HTML elements.
To have a look at how this would work, have a look at the below screenshot.
If you decide to revert to the default functionality in the core WooCommerce template, you can reset the selectors to the default values.
One of the things which I always take very much into consideration when looking for a product is the level of support I can expect to get. Simply put, when things go wrong or I need a helping hand, I really want my supplier to bend over backward and make sure everything is alright.
I hate with a passion those support cases where they’re like ¯\_(ツ)_/¯ and shut me off.
So I always have a go at the support, to see both their responsiveness and their helpfulness. It was great dealing with the support staff here.
Given that the service is actually hosted on their end, they have quite a bit of flexibility at looking at what’s going on, but I was impressed how they followed up with potential solutions, even after a problem was actually resolved, just in case I ran into the same problem again.
It takes quite a lot to positively impress me with support, but RobotNinja’s team have done just that.
Pricing of automated testing
Given that we’ve spoken mostly positively about RobotNinja, are we going to hit a breaking point when it comes to pricing?
I don’t think so.
Priced at $9 per store per month, I do believe this is very reasonable. After all, any shop which is looking to implement automated testing is surely making many times that amount. In fact, a few hours of downtime in your shop are probably going to cost you much more than $9 making the investment very worthwhile.
My opinion is that there should also be an unlimited or a fixed tier. While some people are happy to pay for each store they are operating, this is sometimes a level of administration which is “extra” for some businesses, particularly the recurring revenue section.
If I had to make a suggestion, I’d go for suggesting an “all-you-can-eat” approach, which gives you unlimited access to store testing. While I understand the recurring resource usage of the product, some clients would probably rather not have to deal with the monthly invoicing, administration and potential lapses in payment (and thus access to the service) which might happen with monthly recurring pricing.
When your online shop is driving a significant chunk of revenue to your business, even a few hours of downtime can dent your income for the day. Having your shop under a constant watch, and being alerted instantly as soon as something is not working right will eliminate quite a lot of worry.
Besides being dead-simple to implement, RobotNinja’s automated testing of WooCommerce online shops is cheap. It’s also very comprehensive in terms of the functions tested, ensuring that nothing slips through the cracks.
While the current version is already sufficient, we’re sure this product will be going places.