Gatling for Functional/Integration Tests

Hey All,

I have been using Gatling for some time now for load testing and it’s pretty amazing. I have also been maintaining a separate framework using Rest Assured for my functional/integration tests for my REST API’s. It’s time to consolidate them all into one framework and I want to be able to do that in Gatling.

The only thing that I am still not sure of is the best way to manage my scenarios for my functional tests. I want to run them for a single user - simple enough. One thing that I love about the TestNG/Rest Assure framework is I can easy update an XML file, point to a package with all my tests and tell it to run X tests in parallel. How can I simulate that same thing with Gatling? Each scenario will only be a single user but I want to be able to tell it to run X number of tests in parallel so as I get more API tests I can scale them out and it will run faster.

Any best practices for doing this will be highly appreciated!

Thanks,
Steve

There is not an easy, built-in way of doing that. You can run them all at the same time. Or you could manually tell it to run the first 10, then wait a few seconds, and do the next 10, etc. But “run X at a time” is going to be really painful, if you can do it at all.

But it’s a functional test. Why not run them all simultaneously? Or have “suites” that you run, where the suite runs them sequentially, but the suites are run in parallel?

There are many ways you could accomplish parallelized functional testing. Just not that particular one.

But as a warning: be aware that functional tests usually have dependancies on things like database updates, or previous tests, etc. When you port your test suite to Gatling, watch for those and remove them. Make every test stand 100% on its own. And be aware that with many threads trying to do data setup at the same time, you have to make sure that those threads are capable of being run multi-threaded. Tests that rely on tweaking some database value, for instance, are going to shoot other tests in the foot.

I’m sure you are aware of all this. But it’s always good to get a reminder, right? :slight_smile:

You could use the sbt testOnly task and pass multiple simulations, but they would run sequentially

testOnly *sim *sim2

Also ClickScript allows you to write your tests in a more Selenium way:
https://github.com/clickscript/clickscript

Aidy

Thanks for the ideas!