Category Archives: testing tool

Randomize your test data

Reading Time: 1 minute

TL;DR

This post is about one important testing method that should be automated, test data randomization.

You should randomize test data in automated script because this will make your automated test runs slightly more user likely because application that you are testing will be used by different users that will use different data inputs.

Also, it is very usual that application business rules are data driven. Based on data values, feature behaves differently. Using test data randomization, you can discover and test hidden business rules.

Here is my real example. I randomized account number, and soon realized that feature behaves non deterministic. One attribute output values were different from run to run. I could not define the rule.

I asked developers in dedicated slack channel about this behavior, and they explained that this is client business rule. Based on account first digit, created record was labeled differently (output attribute value). Of course, that business rule was not documented in any form.

In my ruby testing scripts, I use Faker gem. Happy test data randomization!

 

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Docker behind a proxy

Reading Time: 1 minute

TL;DR

In this post I will explain how to set up docker when you are behind corporate proxy.

All Internet tutorials about any technology take assumption that you are not behind a proxy. Working for my client that must use corporate proxy, I spent a lot of working hours discovering how to use docker behind  a proxy.

You first need to find out value for corporate proxy. In corporate environment, this could be rather tricky action, because that value is not always publicly known.

  1. Set docker systemd settings to use proxy.

Use official docker instructions [source]. With this setting, docker daemon nows how to get images from the Internet.

2. Dockerfile.

If you need to tailor your own image, you need to use Dockerfile. In order to enable Dockerfile commands to get stuff from the Internet, you need to set ENV HTTP_PROXY variable.

After FROM directive in Dockerfile, put following settings:

FROM image_name
ENV http_proxy <HTTP_PROXY>
ENV https_proxy <HTTPS_PROXY>

3. Some tools do not use environment variable http_proxy.

There are some tools that made a wrong design decision where they do not use environment variable http_proxy, but they require that command switch must be used in order to set proxy value.

I broke my teeth on following tools:

  • pip
  • npm

Here is simple heuristic. If command from Dockerfile gets timeout (usually it appears to hang when it can not get to Internet), consult documentation for this command to find out how to set proxy value.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

How to replace curl data-binary value to form-data upload parameters

Reading Time: 1 minute

TL;DR

In this post I will explain how master Joda visited me in my dream and asked me important question about one of my previous blog posts: How to measure upload speed of web application upload form [link]. The post provided right information about curl parameter that enables you to see upload speed. But curl example for upload file is wrong!

I found that is wrong when I tried to measure upload speed in real application. And realized that file is not uploaded in application. By observing the copy pasted curl, I noticed that there was not Content-Length header. Bingo, lets create Chrome developer tools issue ticket[link].

Please read comments, because I learned a lot about curl upload file feature. Google developers who answered my ticket did not just dismissed my wrong curl upload file heuristic, they took extra step and educated me!

So, in order to use curl upload file feature, you need to transform something like this:

--data-binary $'------WebKitFormBoundaryoeJQRnHeojsIBayU\r\nContent-Disposition: form-data; name="fileType"\r\n\r\n5\r\n------WebKitFormBoundaryoeJQRnHeojsIBayU\r\nContent-Disposition: form-data; name="file"; filename="elixir-websetup.exe"\r\nContent-Type: application/x-msdownload\r\n\r\n\r\n------WebKitFormBoundaryoeJQRnHeojsIBayU--\r\n'

into this:

-F file=@elixir-websetup.exe -F fileType=5

You can now data-binary parameter and its value from curl.

It is important to have check mechanism for upload file. Use your application features to check is file really uploaded. curl can also help by observing application returned value.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Selenium webdriver Net::ReadTimeout (Net::ReadTimeout) exception

Reading Time: 1 minute

TL;DR

In this post I will explain how I resolved this exception in context of selenium webdriver testing in headless mode using xvfb on linux.

You finally managed to set up linux and xvfb server, your selenium webdriver settings are correct, and you successfully run your first scenario in headless mode! Astonishing achievement when I add fact that you only used open source technology.

You have your cucumber feature files with scenarios, written according every best BDD practice. Although, one feature file has more scenarios than other. Feature that it tests is rather complicated.

You set up jenkins job, and find out in the next morning of run, that only that feature file has failures. You examined execution html log, and find out this cryptic exception:

screen-shot-2017-01-07-at-11-56-08-am

Network timeout!? But site that you test is ready and online.

What is going on under the hood of selenium webdriver tests.

Selenium webdriver is http server. It accepts http connections, according to webdriver protocol that is http based. Your language selenium webdriver bindings start server for you when you create driver and your test script sends webdriver protocol commands to webdriver server. Simple as that.

Above exception means that your selenium webdriver server is not responding. Why? In context of headless xvfb linux test run, this could be caused by various reasons.

Solution.

I noticed that exception appeared always on same scenario, so I split long cucumber feature file in two. If you have properly written feature file according to BDD practices, this should not affect your test suite.

I guess My heuristic is that selenium webdriver server could be up for some limited time and that with long feature file I hit that limit.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Meet Blitzy: not so simple HTTP load tester in Elixir

Reading Time: 2 minutes

TL;DR

In this post I present Blitzy, not so simple HTTP load tester in Elixir. This is my open source contribution to original Blitzy, simple HTTP load tester in Elixir.

My journey with Elixir started six months ago. With proper book from The Pragmatic Bookshelf, this was fun experience. I made myself to do all exercises, but in the end I skipped Macro exercises. How to test my Elixir practical knowledge? The best way is to contribute to some of Elixir open source project.

For one of my clients, I need to do load, duration and concurrent test. I previously used Grinder, Java Load Test Framework. Driven by pure curiosity, I searched for load testing tool in Elixir, and I found Blitzy.

It has simple feature set, do load test for simple http get. By exploring the code and using Programming Elixir 1.3 as a reference, I found out that I can read and build Elixir project code. So, why not add features to Blitzy that I need for my current project.

My first contribution was to update dependencies, and do some refactor because some libs changed their interfaces. This was need just to build Blitzy for current set of features.

In closing session of CAST 2016, there was discussion how can we help to enhance software testing. My contribution, lets create software testing tool, that can be easy to extend, develop and maintain. Another pointer for Blitzy contribution.

Power of Blitzy is that is programmed in Elixir, which uses Erlang virtual machine. Downsize of Erlang is rather cryptic programming language, it feels that you are writing mathematical formulas and proofs, and not a program. But there is Elixir, that resolves that issue.

Blitzy codebase is small, because it uses Erlang virtual machine concurrency and code distribution out of the box features.

I remember that most of the code for Grinder was about those features, distribution and concurrency.

Check github repository, and happy load testing.

I wrote tests for Blitzy, currently line coverage is more that 80%, but I have not wrote most important test that include data. How about that metric preachers? Important unit test are on to do list.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Technology junky

Reading Time: 2 minutes

TL;DR

In this blog post I will describe my TV upgrade that should last for next 10 years.

This summer was Football UEFA Euro competition year in France. Heuristic is that you could by new TV models with significant discount. I bought my last TV in 2008, and it was plasma. TV technology have dramatically changed in those eight years and I did know where to start. My Christmas started earlier this year. I asked my friend, who is real TV junky, for help. He needed just one input, my budget. With my budget of 1500 eur, he started his research. Believe me, it is not an easy task. After few pointers and one week, he hit a jackpot, LG-49UH8507, in my budget range.

This is my short review wearing a testers hat. Basically, I bought computer system . Every computer needs operating system.

WebOS 3.0

You can find technical specification here. From user perspective it is very fast and reliable. UX is pretty good, menus and actions are strait forward. I enabled auto upgrade which is done in sleep mode. When I turn it on, I get notification in upper right corner about the upgrade.

Network

WiFi and Ethernet.

I use ethernet for streaming services. Big surprise was when my Iphone 6 offered to connect to TV while I was watching Youtube. It is called screen sharing.

Remote

It has magic mouse feature, which means mouse pointer that I steer remotely. Remote UX is not so good, because I mostly use it in dark room and I can not guess button that I need based on its position or texture structure.

Display

UltraHD which means 4K resolution. This is Netflix Dardevil in 4K (click for larger image):

img_1231

Entertainment and education

I watch 90% of my time Netflix or HBOGo. Up till last update, Netflix had stability issue. I always exited application, but when I reentered it, it always crashed. HBOGo has streaming issue with new items, but it is stable. Netflix has much batter UX experience when I continue watching where I stopped previously. No streaming issues at all even with 4K items.

There is also youtube player, so I can educate myself from the conform of my sofa.

I am very satisfied with my new gadget. For the same price, I also got LG G3 smartphone, which was big surprise! And salesperson was very educated about the product, he confirmed all technical specs that I knew thanks to my friend.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Cleanup order in selenium headless test

Reading Time: 1 minute

TL;DR

In this post I describe on real example how to use important question for every software tester: “Did I do it in proper order?”

For one client I created environment for running selenium webdriver test suite in headless mode for firefox browser. I use docker image that contains latest Jenkins, xvfb server and firefox browser. I was not able to start chrome with xvfb because chrome has much higher security. More about that environment in following posts.

When I run test suite, I got following cryptic exception:

Failure/Error: Unable to find matching line from backtrace
     Selenium::WebDriver::Error::UnknownError:
       Failed to decode response from marionette
     # ./spec/spec_helper.rb:93:in `block (2 levels) in <top (required)>'

Line that triggered exception was:

@driver.quit

With help of this excellent blog post,  I find how to ask right question: “Did I use proper order of calling different api methods?”

I first closed headless driver (which is xvfb server), and then I tried to close selenium webdriver. That lost connection to its X server manager (xvfb).

After I first closed selenium webdriver, and after it I closed headless xvfb server, test suite worked as expected.

When you investigate what went wrong, use this simple question:

“Did I use proper order?”

 

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

How to measure upload speed of web application upload form

Reading Time: 1 minute

TL;DR

In this post I will explain how we measure speed of upload feature in web application using curl tool.

One of web application feature is to upload a set of files (size in several 100 MB) to web application.

Testing from our office location through various paths (vpn, no vpn, office network, public network) but all using local country Internet connection showed satisfied upload speed.

But client on other continent has poor upload speeds. Developer asked me how to measure upload speed form his browser to web application. Here is how.

First, you need to copy upload post request of your web application using Chrome developer tools, in Network tab find that request and copy it as curl request.

Paste that curl request in your favorite shell (Windows OS developers usually  use git bash) and at the end of cur command add this:

-o output.txt

That’s it. You will get something like this (click for larger picture):

 

screen-shot-2016-12-10-at-6-53-01-pm

 

 

 

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Search in project for method usage using only bash script

Reading Time: 1 minute

TL;DR

This post is about simple bash shell scripts that finds all files that use particular method.

In my previous post: Product moving parts as source for test strategy, I described how I use github pull request in order to discover which part of application changed in order to create regression test strategy.

Code that changed could be some helper method or .css and .jpg assets that are used in various places in code base. And those places are not part of pull request. So I need an automated way to find all places where is that helper method used.

For that purpose I use simple bash script. You need to know loop programming concept and a unix utility commands cat and grep.

Here is bash script:

#!/bin/bash
for i in `cat pull_request_items.txt`
do
  echo $i
  grep -H -r "$i" * | grep -v cache | grep -v manifest
done

And content of pull_request_items.txt

our_overview_gettingstarted.png
tour_overview_lessonhighlights.png
tour_overview_originals.png

Script reads items from txt file, and each row value is searched in project codebase using grep utility. Search is recursive in all subfolders.

Output contains files that contain searched items.

Manual part was to copy/paste from pull request to pull_request_items.txt file and do some editing in order to clean not important pull request information.

Why not use some fancy editor like sublime? Because presented utilities are installed on almost every linux machine in the world and i can use this script out of the box.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Value of UI automation tests

Reading Time: 1 minute

TL;DR

After series of posts about How to kill UI regression testing, maybe you got impression that I am against UI browser automation test scripts. In this post, I will put my thoughts about the value of UI automation tests.

First some context. Here are requirements for excellent UI automation tests:

  • Language that enables you to write less code. Something like Ruby.
  • selenium web driver implementation in that language
  • framework just above selenium webdriver. For example watir-webdriver.
  • Page object pattern implementation
  • test framework, something like rspec. For writing awesome asserts.
  • gherkin implementation. Something like  cucumber. No, I have not changed my mind stated here. But we have different context here.
  • continuous integration tool. Something like jenkins
  • headless browser. Something like xvfb or sauce labs.

What is the value of UI automation test scripts? They represent executable documentation for your product. They help you to answer questions about complicated business scenarios. For example facebook  setting who can contact me.

Your testers will need to have a skill of writing DRY tests using those requirements. So when you have new tester on board, by reading those tests script, he can quickly learn application features.

Those tests would be run on jenkins and run should be triggered manually. Tests will provide you information is some automated feature changed. It is not wise to use those results for you regression testing strategy.

Because those checks, or asserts only check what is coded. Nothing else. And UI is for human users, not for test scripts. So human should always do smart regression testing , using its brain, eyes, ears and fingers.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather