Posts

Showing posts from 2018

TA: Mobile browser - It's all about the touch(start/end)

Image
As we all know, non-touch devices like a desktops have slightly different input from touch devices like mobile. This also means developers do have the option to build a website that does expect touch input instead of a mouse click. If your test suite does do a `element.click` when touch is expected, the click does not fail (at least not currently), so no error is thrown/shown but your script will fail. In one of my previous blog posts I mentioned a solution with execute_script and touchend . I did find out ( with the help of the watir community on Slack ), this can be resolved easier with Selenium and touch action (only supported on Chrome at the moment of writing). The specs In general spec documents are a bit difficult to interpret because of the lack of a clear example, but it gets easier to understand the structure over time. If you look at the specs of selenium-webdriver  you get an overview of all possibilities. There are a couple of points you could look if you think abo

Android Statistics: October 2018

Image
Another month past, Google  released new statistics , so let's find out what changed compared to previous month. Is Android 9 (Pie) finally showing up in the statistics? How many Android versions do you need to support with your app? Let's take a look at the graphs and find out. https://developer.android.com/about/dashboards/ Statistics, facts and trends Versions over time Facts about the Android versions compared to previous month: The landscape is still a jungle of versions with no outstanding dominant version and next month the gap between all will be even closer There are seven Android versions with more then 7% market share Android 9 (Pie) is not showing up yet (maybe next month) Android 8.1 and 8.0 are the only ones with an up trend Android 7.1, 7.0, 6.0, and 5.1 are showing a steady decrease Android 5.0 and 4.4 are at the end of the cycle  Codenames over time Facts about the Android codenames compared to previous month: Androi

TA basics: Making screenshots when scenarios fail

Image
A picture sometimes says more than words. This is also true for test automation. Therefore it could be that you want your framework to make a screenshot when a scenario is failing to make debugging more easy. But how can you make sure your framework does this for you? Since we're using the `lapis_lazuli` gem, this is actually already been taken care off for most scenario's, but if you're using the 'watir' gem, you need to modify your `hooks.rb` file like briefly described on this page . Let's first look at Watir and then move to LapisLazuli to see what advantages and disadvantages are between the two. Watir screenshots Watir by default does not make a screenshot of a failing test, so you need to write some code to make this work. Below a Watir example Keep in mind that this only makes a screenshot at the end of the scenario. Meaning that it can happen that the screenshot is being taken a fraction later and thus missing the real issue. So let's t

Android statistics: September 2018

Image
Google forgot to update the pie chart picture. Is that because they wait for Android Pie (Android 9.0) to show up in the statistics? Or is it already showing up? Google  released new statistics , so let's find out what changed compared to previous month.  https://developer.android.com/about/dashboards/ Statistics, facts and trends Versions over time Facts about the Android versions compared to previous month: The landscape is still a jungle of versions with no outstanding dominant version Android 9 (Pie) is not shown yet Android 8.1 and 8.0 are the only ones with an up trend We see a strong uptrend which might be related to the fact that more phones provide OS upgrades these days Android 7.1 has reached it's peak and is now heading downwards Android 7.0, 6.0, and 5.1 are showing a steady decrease Android 5.0 is at the end of it's cycle and is slowly becoming irrelevant  Android 4.4 is still showing a steady and is heading towards the 5% marke

TA: How to get the Session Storage data from your browser

Image
Our test automation suite for a single page application (SPA) called service-hub , takes almost one hour to run all +- 200 scenario's in serie per browser. The amount of scenario's will keep on growing with the expansion of the product. So I needed to start using some clever tricks to speed up the process. One of those tricks is by testing in parallel sessions. This is a very good thing to figure out anyway, but is also taking more resources (and therefore cost more money). Another trick is by using the API for some of the preconditions that take a lot of time. But for that we need a token which is stored in the browsers Session Storage. Scenario example For the service-hub product which I'm testing, it takes precious time to add/remove a material from an activity if I need to do this all via the UI. There are many steps to take to make sure I'm on the correct page, tab, breadcrumb, sub-tab and finally the element and to cover all other scenario's that might

TA Basics: Do we script a click or a tab?

Image
On most websites and applications you might need to fill in a form of some kind. Some people like to `click` in each field with the mouse, others like to use the `tab` button on the keyboard. But do you need to script both of these scenario's for your automated tests? https://www.service-hub.com/ contact form What to test and why? There are a bunch of additional questions that pop-up in my mind when I ask myself the question: "`Click` or `Tab`, which will be required in our test automation suite?". Because sure, we can automate both scenario's, but why is this needed? Would it be sufficient to automate only one of these? Can we mix them (most fields click and only one tab)? Will automating it save us time/effort?  The answer is simple: "It depends on what you want to test and what the test should be covering".  If you want users to navigate through the website with keyboard tabs, you should test this. If you want users to navigate through

Android statistics: August 2018

Image
August has ended and Google released new statistics . So let's see what changed since they published the  Android statistics of July 2018 . Is Android 9 (a.k.a. Android Pie) showing up in the statistics already? Will Nougat start show a decrease in market share? Let's find out, here are the facts. https://developer.android.com/about/dashboards/ Statistics, facts and trends Versions over time Facts about the Android versions compared to previous month: The landscape is still a jungle of versions with no outstanding dominant version and three versions around +-10% market share Android 9 (Pie) is not shown yet Android 8.1 and 8.0 Continue the up trend Android 7.1 is still increasing with almost 1% in a month Android 7.0, 6.0 and 5.1 are showing a steady decrease Android 5.0 and 4.4 are showing a steady decrease up to 0,5% per month Codenames over time Facts about the Android codenames compared to previous month: Android Pie is not shown in

TA: How to test a simple WebApp

Image
When building a solution for mobile users there are a bunch of solutions to choose from. Responsive Website, Progressive Web App, Android/iOS WebApp or Android/iOS App. All come with advantages and disadvantages. If you have a website that is responsive it's very easy to turn this into a (webview) WebApp. But do you need to test this? And if so, how do you test this? Android WebApp Let's look at a simple Android WebApp example. We now just turned a simple website into a Android WebApp. You will notice you can navigate through the website and when you use the phone back button, it will first navigate back on the website itself unless your at the initial loaded page, in which case it will close the WebApp. It looks just like the regular website, but can we test it the same way? And/Or can we test the responsive website and assume the webapp works just as fine as the webview app? To test or not to test? If you have a simple website, only testing the responsive website

TA Basics: Element selection with the lapis_lazuli gem

Image
In case you've never head of the phrase "All Roads Lead to Rome", it refers to the fact that many routes can lead to a given result. The same counts for finding elements on your website under test. There are many attributes which can be used to find the element you need. So let's have a look at a bunch of functions/options with the `lapis_lazuli` gem to limit the amount of roads a bit but still keep the test reliable. Side note Let's start with something I mentioned in a previous post , but it's good to keep in mind. The ` lapis_lazuli ` gem is an extension build on top of the ` watir ` gem. Even though I focus on LapisLazuli functions, you can also use the Watir way instead to locate the elements or even combine the two to a certain extend. Documentation All LapisLazuli documentation for locating elements can be found on the testautomation.info website. And also on github , but this is less complete. Since most of the element selection information

Android statistics: July 2018

Image
Finally new statistics have been released  by Google. They skipped June and most of July and I think they forgot to update this page  until I asked them about it.  So what changed since the published Android statistics of May 2018 ? Does Oreo have more market share than KitKat? Will Nougat keep on gaining market share or did it reach it's peak? Let's find out, here are the facts. https://developer.android.com/about/dashboards/ Statistics, facts and trends Versions over time Click to expand versions over time image. Facts about the Android versions compared to previous month: The landscape is now a jungle of versions with no outstanding dominant version and three versions around +-10% market share Android 8.1 finally started to gain some significant market share Android 8.0 is goin up fast (past Android 4.4 & 7.1) Android 7.1 is still increasing in market share, passed Android 4.4 now Android 7.0 was expected to stay stable a bit longer, but is decreasi

Selenium-grid - A simple desktop setup on Windows

Image
Using a selenium-grid can have many advantages, especially on bigger projects. One such advantage is that you can run many tests in parallel. Another advantage is that you only need to run your tests to one point (the selenium-grid hub). The hub will sort out if it has a connected node that is matching your request and if so, it will serve your tests to that node. Selenium grid Assumptions/preconditions You know how to download and install Java (from java.com ) You know how to download the webdrivers (also previous post) You know how to add a PATH to the PATH variable of Windows (see  Google ) Make sure Java and the webdrivers are in the PATH variable Start the hub Download the Selenium Standalone Server  and run this in the commandline: java -jar <filedir\filename>.jar -role hub Allow the firewall setting if/when this pop's up. Start the node java -jar <filedir\filename>.jar -role node This will just register the node to the hub with some de

TA Basics: How to use the helper files

Image
When you just start with test automation, you most likely search and interact with elements within your `*_steps.rb` files (the files that contain the precondition, interaction and validation steps). So most likely across the steps, you have repeatedly located and interacted with the same elements a couple of times. And as long as your test suite is small, adjusting it only takes a small bit of time and it works, so who cares, right?  But now imagine you have a 100 scenario's, 100+ (precondition, interaction and validation) steps. And in a bunch of them you've locate the same element. But because of a change in the website this button cannot be found anymore. Are you going to adjust this in every line in your code to fix? Your answer should be: "NO!". You could use nested steps , but this becomes really confusing really fast and is not a good practice. So let's have a look at a proper solution, the helper files. Structure We basically define four main layers i