Learning center

FAQ

All commonly asked questions are posted here. Questions are classified by gategories to help you quickly access answers - click on a category below. Feel free to contact us if you are not able to find the answer here.

How does the text editor work?

Load scripts are used to program the behaviour of simulated clients in a load test. Each user scenario has its own load script that determines exactly what objects the simulated user will load from the target site during the load test.

The load scripts are programs written using the high-level programming language Lua and can be very simple or very complex, depending on the requirements and programming skills of the tester.

There are two different editors available to load script programmers – the graphical editor and the text editor. The graphical editor is menu-based and makes coding a bit easier if you’re not a very strong programmer or not too familiar with Lua, while the text editor is more powerful and easier to use for the advanced programmer.

The text editor allows you to type in Lua code directly, designing your load script from scratch. It also lets you perform on-screen cut-and-paste, which can be useful as it lets you write the code somewhere else, in an editor of your choice.

Load script example

 -- (This is a comment line)
 -- My load script V1.0
 --
 -- Make an initial HTTP request to get the index HTML page from the site
 http.request_batch({
    {"GET", "http://loadimpact.com/", nil}
 })
 --
 -- Make a series of requests to fetch remaining objects on page
 http.request_batch({
    {"GET", "http://loadimpact.com/favicon.ico", nil}, 
    {"GET", "http://loadimpact.com/css/all.css", nil},
    {"GET", "http://loadimpact.com/js/jquery.js", nil},
    {"GET", "http://loadimpact.com/js/loadimpact.js", nil},
    {"GET", "http://loadimpact.com/js/main.js", nil},
    {"GET", "http://loadimpact.com/js/browserDetect.js", nil},
    {"GET", "http://loadimpact.com/js/cachemanager.js", nil},
    {"GET", "http://loadimpact.com/images/rss-16.png", nil},
 })
 --
 -- Sleep a random amount of time between 10 and 20 seconds (simulates user think time)
 client.sleep(math.random(10000, 20000), 1000)


See also: - The Load Impact load script tutorial
 - The Load Impact load script API
 - How does the graphical editor work?


Permalink