My Daily Tool Use [Updated #2]

SublimeAs a performance tester I spend most of my daily time somewhere between the browser and a web server. I also so spend a lot of time on servers themselves analysing data. So I thought I’d write a bit about the tool landscape I tend to use. In my tool selection I favour Open Source software. Mainly because I don’t have to fluff around with licenses but also because I can look at code if I need to. It allows me to focus my resources on training people. I do tend to feed back into OSS, whenever I can (which is seldom as I am usually not that clever;-) ).

I also do a lot of bespoke programming to automate processes. This is not at the level a developer would do things but more on a simple scripting level. But not to be underestimated what power this can unleash in your day to day work.

Continue reading

Advertisement

ATD2016 a Solid Success

I’ve just returned from Melbourne, where the inaugural Australia Testing Days 2016 (#ATD2k16) was held. I love these conferences. They are really what drives our community. In this case the TEAM Meetup Melbourne gave rise to the conference, which is new. Usually it’s the other way around, that smaller groups emerge from conferences. Nonetheless  I thought it was a great success. People seemed to enjoy themselves and by the amount of participation I saw they were keenly interested too.

Continue reading

Controlling JMeter ThreadGroups with -1

When I script large JMeter projects I immediately default to run scripts through config files. That means that all sorts of variables get pre loaded at the start of the test (VariablesFromCSV is a huge help!). From there I control things like URLs, usernames and passwords,… but I also control Thread Groups. Recently I came across the issue that I wanted to switch in such a config file between a test that ran for a certain length of time to a test that ran only X number of iterations.

For all of you that have used JMeter you know that that might be an issue.

Continue reading

Australian Testing Days 2016 in Melbourne

For those that have missed this so far, take note that there will be a cool conference coming up in Melbourne with yours truly. My expectations are high for the 1st Australian Testing Days conferece. The lineup and topics look top notch. Have a look here: https://testengineeringalliance.com/australian-testing-days-2016/

If you decide to book use ERLEWEIN15 in the coupon section for a 15% conference discount.

ATD2016

A simple JMeter Execution Framework

GitHubFor years I have been thinking of open sourcing the work I do. I see the Blog here as a simple part of that effort. The main -selfish- reason though is, so I don’t have to carry code around from A to B and I can safeguard it from someone claiming it as their own (even me). Open sourcing is something easier said than done. Especially if things are over a certain size and the things I do are usually very tailored to the project context, which makes it difficult to generalise.

But… all things have to start small. I have released WinMinoTaur on GitHub today. These are just some small Windows batch files but they make test execution life with JMeter a bit easier. You no longer depend on the UI to execute tests.

Continue reading

Every Tester is a Performance Tester

…at least to some degree. Well, there are human conditions that distort the perception of time but it’s highly unlikely that you’re one of them. So you are a performance tester too.

The biggest annoyance for a performance tester is to get code into a performance environment that CLEARLY has issues that can be detected by the simplest means available (well.. second most annoying, as finding obvious functional defects is even worse). This is where you as a (whatever kind of) tester come in.

You know the times you drum your fingers on the desk waiting for that spinning wheel in the browser to come back? The batch job where the execution is exactly “making one cup of coffee” long? The usual response from you would be to shrug and say something like “This is just the environment. It’s system test afterall.” or “Let performance testing take care of it”.

Now, I can totally relate to such sentiments! We’re all busy and have deadlines to meet. I’d make the case though that you’d actually help the project as a whole and thereby yourself too by not ignoring such issues.

Continue reading

Iterating over a CSV file in JMeter

A common problem in JMeter is that you want a CSV file as an input and want to execute each line, then continue. So from a script perspective that would look something like this:

Thread Group
 |-For Each CSV Line
 |  |-HTTP Request (CSV input)
 |-Do something else

The issue though is there is no “For Each” concept in JMeter. I know that it is called a ForEach Loop in JMeter but it isn’t from a developer view. You need to know the length of your CSV file. You could just tell the For loop how many lines there are but that would make it very unflexible. You’d need to adjust the script every time the CSV changes.

So here is how I solved it. Not elegant but it actually works quite well.

Continue reading

Loading File Contents Into a JMeter Variable

Sorry for the ongoing spam about JMeter stuff but I am writing a LOT of coding at the moment and I thought I’d share some of the knarly stuff I come accross so others might benefit.

So I had the issue that I need to cobble together MIME HTTP/SOAP calls that contain attachments. JMeter has the ability to add files statically to an HTTP Request (Body Data) but if you need more control you need to roll your own. Best way to do this would be to load the file into a variable and just attach like this:

...
--MIME_boundary
Content-Type: application/pdf
Content-Transfer-Encoding: binary
Content-ID: <MyFile.pdf>
Content-Disposition: attachment; name="MyFile.pdf"

${AttachmentFile}
--MIME_boundary--
...

But how do you get it into the variable?

Continue reading

HMAC and SHA256 in JMeter

Some projects require authentication features that involve some quite intricate steps. But fret not, in JMeter we can use Groovy to do the heavy lifting. Below is a very simple example of how you can do a HMAC encryption. It also includes the SHA256 hashing and base64 encoding. The only thing missing are the functions to read the variables from JMeter and publish the hash to JMeter but that is trivial and you can fit it into whatever you already have scripted.

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidKeyException;

String secretKey = "secret";
String data   = "Message";

Mac mac = Mac.getInstance("HmacSHA256");
SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey.getBytes(), "HmacSHA256");
mac.init(secretKeySpec);
byte[] digest = mac.doFinal(data.getBytes());
encodedData = digest.encodeBase64().toString();
log.info("HMAC SHA256 base64: " + encodedData);

by Oliver Erlewein

 

JMeter and Controlling HTTP Keepalives

jmeterThreading and keepalives in HTTP are always an issue in performance testing and testing tools. When does a keepalive session start and how many are started is a thing of mystery. So having a bit of clarity helps. On my current project I wanted to prove what thread connects to what server for how long.

Continue reading