开发者

PHPUnit+ZendFramework ::How I can test multu users session in the same time?

I beginer programmer,and don't have any QA experience

(only simple test that i write without PHPUnit or other tool)

How I can create tes开发者_高级运维t for testing multi users sessions in the same time?

(PHPUnit+ZendFramework)

basic tests examples that I thinking to do (I am not QA - I soory if i wrong):

  1. users logins in the same time
  2. users buy process - only 1 user can write and the rest only read.
  3. How much session the server can handle in the same time. etc..

Thanks


For number 3, you're really talking about benchmarking, not testing. Take a look at ab - Apache Benchmarking tool

You can do things like the command below, which sends 5 concurrent requests at a time and sends 1000 requests overall to the website:

ab -n 1000 -c 5 http://domain.com/index.php


Kudos to your interest in both ZF and test-driven development. They're both great things to be learning.

You are going to run into a problem when creating tests to specifically check that your application is working correctly under the circumstances you provided.

Unit testing is generally intended for smaller atomic behaviors. You will need to create tests that assert your application performs a necessary component of this workflow, but bringing them all together is actually beyond unit testing's scope.

You can work around this and still use tests by appropriately implementing a state design pattern which will determine, for instance, if a particular mock item being bought is in a 'locked' state when a mock user purchases it. Of course, creating stable mock objects that behave the way your data should when built into models is another issue all together.

Finally, #3 is a little problematic, because that's not anything to test. If your server is over capacity, what are you going to do -- shut down the site? A test-driven approach isn't exactly compatible with the issue of capacity. You will want to actively profile the speed and memory consumption of your site, as well as monitor real user behavior. If you find yourself at a point where you are coming close to capacity, then it will be a good idea to upgrade your hardware or hosting.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜