1

This isn't a question of what stress testing tools are out there. I'm afraid it's a lot harder than that. (At least for me)

Consider a restful architecture for a forum or blog that generates random IDs for each post.

Simulating creating those topics/articles would be simple, because you'd just be posting form data to an endpoint like: /article, or /topic

But how do you then stress test commenting on those articles/topics? This is different, because the comments need to belong to an article/topic, which means that you need the ids of those items. However, if all you can do is issue posts, and you have no way of pulling those ids, you'd be unable to create them.

I'm creating a site that is similar in this regard, and I have no idea how to stress test the creation of the comments.

I have two ideas, and they're both pretty awful:

  1. Generate a massive system ahead of time with some kind of factory, and then freeze it. From there, I figure I'd have to use some kind of browser automation to create my 'comments' on all of this. The automation would I suppose go through a recording proxy, like what JMeter offers. Then, to run the test, I reload the database, and replay the massive log file.
  2. Use browser automation for the whole thing, taking advantage of the dynamic links delivered in the HTML page. The only option here would be Selenium, and really, we're talking a massive selenium grid that would be extremely expensive. Probably very difficult to maintain also.

Option 2 is completely infeasible near as I can tell, but option 1 sounds excruciating. I'm really hoping someone can suggest something more clever.

4

3 回答 3

3

Option 1.

I mean, implementation notes aside, you're basically just asking for a testing environment. So, the answer is to make one. In whatever fashion:

  • Generate it
  • Make it once and reload it
  • Randomise it

Whatever. It's the approach to go with.

How do you your testing is kind of a side issue (unit testing/browser/whatever, up to you).

But you've reached a point where you need to test with real data. So make it happen.

于 2010-11-19T03:29:23.337 回答
3

This is a common problem. We handle it by extracting the dynamic parts of the URLs from the server responses. I presume this system uses web browser client - which implies that those URLs are being sent in the server responses. If they are in the responses, then you CAN get them. However, since you said "if all you can do is issue posts, and you have no way of pulling those ids", then perhaps this is not the case? In that case, can you clarify?

We've recently been doing a lot of testing of Drupal systems for our customers - which has exactly the problem you've described. We either solve it by extracting the IDs dynamically from the page as the user browses to the page they want to comment on, or we use option 1, or a combination of both. Note that if you have a load testing tool handy, then generation of content is not too difficult - use the tool to do it. I.e. run a "content generation" load test. Besides yielding useful data on its own accord, that will give you a test database that you can then backup/restore as needed to maintain your test infrastructure. Now you can run the test on a more realistic environment - one that has lots of content already in it (assuming, of course, that this is realistic for your purposes).

If you are interested, I'd be happy to demo how we solve the problem using our software (Web Performance Load Tester).

于 2010-11-19T13:42:43.187 回答
0

I have used Visual Studio to solve this kind of problem. Visual Studio allows C# coded web tests that can programatically parse the html returned and take action based on that.

I was load testing a SharePoint website and required information to be populated ahead of time. I did create a load test that was specifically for creating "random" pages of content ahead of time. I populated a test harness database with the urls ahead of time, allowing some control over the pages that were loaded.

With a list of "articles" available and a list of potential comments, it is possible to code a pseudo-random number generator (inside a stored procedure because of the asynchronous nature of the test harness) to get a repeatable load test. That meant that the site would be populated in the same way each time the load test was run.

It does take some effort to create a decent way of populating the site off the bat, but the return in the relevance of the load test is quite good.

于 2010-11-21T22:43:16.937 回答