Ever tried adding bulk comments to an article?

Sreenivas Mothukuru

[United Online Software Development & Pvt. Ltd.]


A few days back I encountered a strange behavior while working on an issue which I feel worth sharing.

The test case is to check comments section when number of comments for an article are ‘n-1’, ‘n’ and ‘n+1’ (where n = 2000,  3000, etc.). My goal is to identify the point where the comment section breaks in lower environment with ‘n’ comments. I queried QA database and didn’t find much data to check all scenarios. Now my challenge is to quickly create dummy data in QA environment to identify the point where comment section breaks.

How to quickly add bulk comments to an article?

To do this there are several approaches … some of them are
a)   Add entries (comments) manually till required number of comments were added.
Cons: Clumsy and time taking process.

b)   Write DB scripts to populate numerous records on one go.
Pros: Quick and efficient.
Cons: This approach works in most of the cases but not always. Also, it doesn’t seem to work when lot of tables re involved in the update. Moreover, it doesn’t mimic real time “add comment” functionality.

c)   Browser level automation script.
Pros: Quick and efficient.
Cons: Although this approach is far better when compared with (a) and (b) but, not the best! If we realize the fact that request / response at browser level will take good amount of time!

If not manually ... if not at DB level ... if not via. automation@browser level then what is the best approach to add bulk comments?

Automation at HTTP level is the best optimized way to deal in such scenarios. I chose HTTP level automation because comments can be quickly added at http level. Since the tests are done directly at HTTP level, http level test script doesn’t care about downloading all the embedded objects, rendering issues, HTML/JS changes on the page.

In the first attempt http test script ran for almost 18 hours and posted 2000 comments to an article.

Statistics (First Run):
No. of comments added: 2000
Min response time: 28.31 Seconds
Avg. response time: 33.25 Seconds
Max response time: 121.27 Seconds
Total run time: 66505.20 seconds (i.e. ~18 hours)

Good thing: I was able to add comments at http level :)
Bad thing: Http tests took much more time than I anticipated :(

I was very disappointed after looking at the response time as response time (Minimum, Average & Maximum) was huge! Keeping HTTP level tests aside, if I start posting comments manually I can comfortably post more than 2000 comments in less than 18 hours!

Question: Why http level test was damn slow? Why huge response time? What went wrong?

After looking at the huge response times for each http request I strongly felt that something went wrong and started analyzing the script and results. After some research I made a small change in test script and executed the tests. Interestingly, I observed drastic decrease in response time and tests completed in 49 minutes (i.e. less than an hour).

Statistics (Second Run):

No. of comments added: 2000
Min response time: 1.49 Seconds
Avg response time: 1.49 Seconds
Max response time: 2.97 Seconds
Total run time: 2994.84 seconds (i.e. 49.914 minutes)

One small change made Second test run 22 times faster compared with previous (First) test.
Do you like to know what the change is? Check below links …

Ever tried adding bulk comments to an article?

Share this article with your friends/colleagues if it is worth sharing

My Approach Towards Automation:

Rock & Roll With Http Level Testing

Views: 35

Tags: http, mothukuru, online, sreenivas, testing, united


You need to be a member of Test Republic to add comments!

Join Test Republic

© 2014   Created by Test Republic.

Badges  |  Report an Issue  |  Terms of Service