Create RestApi endpoint with k6 script

Hey everyone,
Is three any why to test with k6 this scenario:
We calling RestAPI with some client code and that client is RestApi server too, is there any way to spin up server in k6 script code ?

Thx shlomi

Hi @Shlomitubul
Welcome to the forum.
No, k6 doesn’t support starting web servers in the scripts but is it truly necessary? In general, I’d say that both REST APIs should be load tested separately. Going by your description these APIs are chained so when you’re testing your second REST API you’re indirectly testing your first REST API, is that right? In that case, you might find mocking useful and in case a web server must be mocked inside k6 script, please check out this extension:

1 Like