Creating and Running Threads

Creating Thread Items

There are two main ways to create Thread Items in your script:

  • Drag a Thread Item into the Script Tree from the Toolbox (press Ctrl-T to see the Toolbox) - this creates a new, empty Thread Item and sets it to be the recording point for your script. If you then browse using the browser, the thread item will record requests to be executed.
  • Convert an Existing Step - you can right click on any Step in your script and choose "Convert to Thread Item". This will take all the child items of that step and put them into a new Thread Item that you can use to run threads.

Of these two approaches, the second one is usually more convenient because it allows you to record your script as a normal Step which you can test by playing back first. You can then easily add Assertions and other items to the Step before converting it to a Thread Item when you are finished.

Running Thread Items

Thread Items are intended to be executed in the normal flow of your script - that is, they are launched by your script as it plays through. This allows you to add several different Thread Items to your script to simulate different activities and have Badboy launch them all.

For testing, the easiest way to run your Thread Item is to right click on it and select "Play" - this causes just the individual Thread Item to play.

Stopping Thread Items

Normally, Thread Items stop by themselves after the period of time for which they have been configured to run. Note that this applies even if the rest of your script finishes playing - so your threads may continue running even after everything else finishes. For example, if you have configured your Thread Item to run for 30 seconds then after you select "Play" it will continue running for 30 seconds even if the rest of your script finishes. There are various options for how to configure the run time - see Configuring Thread Items for information about how to configure the run time of your Threads.

During testing you may often want to stop your threads manually before they are scheduled to finish. To do this, press the "Stop" button in the toolbar or hit the Ctrl-Alt-Space keys to forcibly stop all your Threads from running. Note that even then it may take a few seconds for the Threads to completely stop, especially if you are running threads using the External MSHTML Browser engine (see Choosing a Browser Engine for more information on Browser Engines).

Other Topics Related to Thread Items

Badboy Documentation Generated on Mon Dec 29 22:28:41 EST 2008