使用 Cucumber 进行压力测试
我目前正在使用 cucumber 为 RoR REST API 编写集成测试。
我还想对 API 进行压力测试,并且想知道如何重新使用我的 Cucumber 场景来执行此操作。
我之前使用过 JMeter 和 httperf 进行压力测试,当然,使用这两种工具都必须编写或记录我想要包含在压力测试中的测试。由于我已经有了想要测试的 Cucumber 场景,因此我试图避免重写压力测试工具语法中基本相同的场景。
有人可以推荐一种我可以使用我的 cuke 测试的方法吗?理想情况下,我想模拟数百个并发用户访问 API。
I'm currently writing integration tests for a RoR REST API using cucumber.
I'd also like to stress-test the API and was wondering how I might be able to re-use my cucumber scenarios to do this.
I've used JMeter and httperf before for stress-tests, and of course with both tools had to write or record the tests that I wanted to include in the stress testing. Since I already have the scenarios in Cucumber that I want to test, I'm trying to avoid having to rewrite what would be largely the same scenarios in the stress-testing tool's syntax.
Can anybody recommend a way that I could use my cuke tests for this? Ideally, I'd like to simulate hundreds of concurrent users hitting the API.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您很可能必须创建自己的负载线束。本质上,您需要启动多个线程,每个线程都调用进程来启动您的场景。当每个线程启动时,您会希望有一个延迟交错,因为加载 Ruby 解释器会产生一些开销。出于同样的原因,您可能还必须将负载分散到多台计算机上。最好在单独的进程中执行此操作。也许这对新项目有好处?
You very well may have to create your own load harness. Essentially, you'll need to start up a number of threads, each calling the process to start your scenarios. You will want to have a delay to stagger when each thread starts because there will be some overhead involved with loading the Ruby interpreter. You may also have to spread the load across more than one machine for the same reasons. It would probably be best to do this in separate processes. Perhaps this might be good for a new project?
嗯,创建一些对 httpref 执行系统调用的步骤怎么样?
Hmm, what about creating some steps that perform a system call to httpref ?