#2 Command-line interface


In principle, the capabilities of Hammerora are limited only by the user's ability to script what they want in Tcl, using the examples provided in the supplied benchmarks. This is what makes it a great tool. I hadn't seen Tcl until I recently started looking at Hammerora, but I have been to adapt the TPC-C with AWR driver script to run custom queries to my own requirements. But there is one thing that stops me giving Hammerora full marks - I can't run tests unattended. My test environment is used by others during the day, so I would like to be able to run Hammerora overnight. Would it be possible to add a command-line interface so that commands could be put into a file and run in batch? (I am running Hammerora under Windows XP.)

I have seen the question in the forum "is it able to execute hammerora without the GUI via command line?" https://sourceforge.net/projects/hammerora/forums/forum/292313/topic/1895281


  • Steve Shaw

    Steve Shaw - 2011-03-17

    As you rightly raise I have had this question before and although potentially it may become a feature in the future I don't want to set unrealistic expectations. Given limited development bandwidth there are numerous other enhancements and features in the run queue, for example Hammerora 2.6 will include the TPC-H workload for MySQL and there is also an alpha version of a SQL Server TPC-C workload in the pipeline. Additionally the TPC-H documentation is pressing so the request for a command line version has been noted but will not reach the top of the development run queue in the immediate future.
    Saying this however I would not agree that you can't run tests unattended. Firstly the autopilot feature enables you to do exactly that. With the autopilot feature you can define a sequence of virtual users that will run a test for defined period of time, then when you press the autopilot button it will run the entire sequence of tests unattended, choosing to output to the log file is a good idea to then save the results for when you return.
    But then I guess your next question is what if you want to run a different script on each iteration? You can do this also because as you rightly say "the capabilities of Hammerora are limited only by the user's ability to script what they want in Tcl" - this is actually very perceptive because I agree entirely - you can't have a real load testing tool unless you have a scripting capability and after looking at a number of options I chose TCL as it was the most powerful available (that also had multi-threading capability and native database API interfaces).
    So to run different scripts on each iteration you have a couple of options. Firstly for a small number you could use a switch statement - such as in the example of the AWR report, for a large number you could put your scripts in files and use the TCL commands to open the files for reading (you can safely open files for reading in multiple threads at the same time). For more control you could use a framework similar to the build scripts for the TPC-C and TPC-H schemas, define one user as the master thread that then controls the other users using TCL thread shared variables (see the examples looking for the use of the tsv keyyword). In the master thread you can then define a control file that can be read from and written to to define the test currently in progress. eg in the master thread open a control file read "Test 1" into a tsv, the other virtual users read the tsv open the relevant file for test 1 and run the test, when all virtual users are complete thread one updates the control file to "Test 2" so when autopilot runs the next test it then reads "Test 2" and so on. As you say the possibilities are extensive given the rich feature set of the TCL language so given some thought it should be achievable to build your own batch framework.
    BTW it is worth noting in passing that there is a command-line prompt in the bin directory at which you can run any of the scripts you have written, however this will not give you multiple threads so I recommend using the GUI framework to test with multiple users.



  • Steve Shaw

    Steve Shaw - 2012-08-03

    Command line functionality and more now added with Autohammer extension

  • Steve Shaw

    Steve Shaw - 2012-08-03
    • priority: 5 --> 1
    • status: open --> closed