Skip to main content

Posts

Basic setup and configuration of TestObject in Node JS for testing of a web application

If you are already using SauceLabs for automated web UI testing on mobile devices, then you could be interested in trying TestObject cloud service that was acquired and became a part of SauceLabs family in 2017. It allows you to run your existing tests on real devices (Android and iPhone). SauceLabs provides emulators, which work quite well, but, depending on the requirements of your project, you may need to execute tests on real hardware. Another reason for switching to TestObject could be using the latest version of Android OS which may not be available at SauceLabs. At the moment of posting this article the latest supported version was Android 7.1 on SauceLabs and Android 8.1 on TestObject. Luckily the transition to TestObject is quite seamless. You don't need to modify your existing automated tests, only the provider endpoint and a few capabilities. The disanvantage of using a free Testobject account is that you are limited to only a few devices which are marked as Free in th

Annotating Sauce Labs tests in Node JS

SauceLabs does not annotate jobs by default, showing the question marks instead of statuses, and the name of a job is always set to "Unnamed job". Luckily we have all the powers of Sauce Labs REST API in our hands and can both set the name of a job and its final status to something more meaningful. This example demonstrates how it can be done in Node JS. Every Sauce Labs job has a unique ID. We get this ID from the Webdriver object. saucelabs.js main.js

Reading a Gitlab pipeline variable in NodeJS synchronously

I'm assuming you already created your project on Gitlab and got your personal access token . This is a simple synchronous function that reads a Gitlab pipeline variable in NodeJS using Gitlab REST API v3. It uses sync-request that is not recommended to use in a production environment, although it can be successfully used in automated testing and various scripts.

Increasing sound volume for recorded files on Linux

One-liner for increasing sound volume for recorded files on Linux (make sure ffmpeg is installed): for file in *.3gp; do ffmpeg -i "$file" -af "volume=15.0" ./conv/"${file%.3gp}".mp3; done The line above will increase sound 15X for all files with .3gp extension in the current directory and saves the resulting .mp3 files into ./conv subdirectory (make sure it exists).

JMeter: getting a value from the randomly selected variable

Assuming we have a CSV Data Source with multiple rows and 10 values in every row. We are parsing and storing the values into a set of variables, named var1,var2,var3,var4,var5,var6,var7,var8,var9,var10 . Now we can use these variables in any step using ${varN} reference. But what if we want to select a variable from this list randomly? So that one iteration would use var3 , and another iteration would use var7 , selected randomly. I have used the following solution: Create additional user defined variable varTmp using "User Defined Variables" config element. Create "Random Variable" config element with variable name rnd , minimum value 1 and maximum value 10. Then use BeanShell PostProcessor that will store the value from randomly selected variable (var1-var10) into varTmp . We need to define two fields in the config element:  Parameters:  ${__V(var${rnd})} Script: vars.put("varTmp", bsh.args[0]); Now we can use ${varTmp} as a reference to the

Shell script to wait until your site becomes reachable and returns code 200

Sometimes you don't know when a server becomes reachable and you just need to wait, while continuously pinging it with a certain interval. This is a shell script that does everything for you (including a timeout if host is not available during a specified period of time). It accepts two parameters: hostname of your site and a timeout in seconds.

Accepting long options with getopts in your shell script

Normally you can only have single-character options when processing your arguments with a standard getopts utility in Linux or Mac OS X. You can use getopt for long options, but it is not included in the standard Mac OS X installation. So this is a trick that will allow you to simulate long options with a standard getopts, that will work on all *nix platforms without additional software installations. This function will also print a usage tip if you execute the script without parameters (or with -h parameter).