How do I handle external dependencies with k6?

I need to load test an application where it depends on external hardware configurations in order to submit a form. Like I need to select a device in the form which I’m testing but without actually configuring a device I can’t select a device and I can’t submit the form as it a required field. However for testing purposes, it’s not possible to actually configure a hardware device to perform the load test. So is there anyway to somehow mock the external dependency to perform the load test?

Hi @d33psan,

Like I need to select a device in the form which I’m testing but without actually configuring a device I can’t select a device and I can’t submit the form as it a required field.

Let me check if I’m getting your question. Are you testing a web application where there is a form you have to fill with a field about the device that is auto-populated detecting it from the device?

Do you know how they are detecting it behind the scene? Are they using the user agent from the browser?

Depends on what type of interface you are requiring to be mocked

if it’s a standard restful api there are plenty of tools about to mock these type of systems, the best i’ve found is mountebank.

It has a number of built in protocols (http/s, tcp and smtp) and some extensions of varying complexity, a single instance can do around 2-300 calls per second and as an added bonus is built on node.js which means javascript coding :slight_smile:

If you need anything custom you can build your own but when I needed an mq mock service was easier to roll my own based on java code. (no slight on mountebank I just didn’t have the time to learn how to build a custom interface as i already knew a lot of java and mq).