Sahi Pro - Load Testing with Sahi Pro

abstract Sahi Pro lets you run load tests on your application. There are 2 Sahi scripts involved in this. One is used to generate the load. This script is called the noise and is run on a headless browser. The steps in the noise file are generally in an infinite loop so that they never terminate. The other script is called the subject. The subject is the script whose steps you would like to measure periodically at different loads.

Instructions

  1. Get the headless browser, PhantomJS. Read this article to add PhantomJS to Sahi.
  2. Start Sahi Pro. PhantomJS should be visible on the Dashboard as one of the browsers.
  3. On the dashboard, click on the 'Bin' link. This will open up a command prompt at userdata/bin.
  4. On the command prompt, run
    dload.bat demo/load/noise.sah demo/load/subject.sah http://sahi.co.in/demo/training firefox

This will do the following:
  1. Run 1 (min) thread(s) of noise.sah on PhantomJS (This will not be visible)
  2. Run subject.sah on firefox browser and store the time of steps.
  3. Wait for 5 seconds (interval).
  4. Run 2 (incrementBy) more threads of noise.sah on PhantomJS.
  5. Run subject.sah on firefox and store results.
  6. Keep incrementing the noise threads at periodic intervals, run the subject, and store results, till it reaches max noise threads. Once done, click on 'Logs' link on the Dashboard to view results.

Summary Plot:

Steps:

To test your application, go to userdata/scripts/demo/load folder.
  1. Open noise.sah and add your sequence of steps. These steps should be representative of a normal user interaction. Note that your steps should be in a while(true){} loop so that the threads don't die out. (Refer to existing noise.sah)
  2. Open subject.sah and specify the sequence of steps whose reaction times you would like to measure at different loads.
    The parameters min, max, incrementby, interval etc. can be edited in dload.bat file.
    It is also possible to involve multiple machines in creating the load by modifying the 'NODES' variable (Look in dload.bat)