Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What test harness tool/framework can test concurrent requests in a Rails app? [closed]

How can I test my Rails app with N concurrent users?

These simulated users will do some actions like upload/download files, etc.

Are there any frameworks or free tools that support this?

like image 941
Blue Smith Avatar asked May 20 '12 04:05

Blue Smith


People also ask

How to test rails app?

We can run all of our tests at once by using the bin/rails test command. Or we can run a single test file by passing the bin/rails test command the filename containing the test cases. This will run all test methods from the test case.

How to test controllers rails?

The currently accepted way to test rails controllers is by sending http requests to your application and writing assertions about the response. Rails has ActionDispatch::IntegrationTest which provides integration tests for Minitest which is the Ruby standard library testing framework.

What is Minitest in Ruby on Rails?

What is Minitest? Minitest is a testing suite for Ruby. It provides a complete suite of testing facilities supporting test-driven development (TDD), behavior-driven development (BDD), mocking, and benchmarking. It's small, fast, and it aims to make tests clean and readable.

How do you test a method in Ruby?

Most methods can be tested by saying, “When I pass in argument X, I expect return value Y.” This one isn't so straightforward though. This is more like “When the user sees output X and then enters value V, expect subsequent output O.” Instead of accepting arguments, this method gets its value from user input.


2 Answers

ab(Apache Benchmark) is made for that. Here is an example:

https://github.com/igrigorik/async-rails

like image 155
seph Avatar answered Nov 15 '22 18:11

seph


I use jMeter, although the UI is a little rough IMO. I ended up sharing a lot of code between my easyb (Groovy-based) specs and a mini-DSL I used to create jMeter config/execution files (XML) so redundancy between specs and load testing was reduced. The same should be doable in Ruby as well.

JMeter allows concurrent testing, ramp-ups, all sorts of stuff. I don't know if it does everything a commercial tool does, but I've used it for a long time on a wide range if apps and it's been, more or less, satisfactory.

like image 40
Dave Newton Avatar answered Nov 15 '22 18:11

Dave Newton