Sunday, 28 September 2008

Book Review: Apache JMeter by Emily H. Halili

This book only has 120 or so pages and has the purpose of introducing the reader to JMeter. I haven't found the online documentation for JMeter an easy read - mainly because I could not find a nice easy to print or flip through pdf version. The online document serves a reference rather than a hand holding purpose.  Hence the need for this book.
amazon.co.uk | amazon.com


Sadly the first chapter does nothing to help the book - at only 7 pages it doesn't take up much space - but... The chapter covers - why to automate testing, how much to do, how to justify the cost - all the standard automation justification stuff - but given that this book does not have the title "Automated Testing with JMeter" I assume that if you pick up this book then you probably already know the stuff in this chapter. In fact the author recommends you skip this chapter if you already have some understanding of test automation - I recommend you skip it regardless.
In Chapter 2 I found JMeter sold to me as a more general testing tool than I expected - I hadn't revisited the JMeter feature list for a while so I did not expect to see such an attractive set of features, and I didn't know that JMeter has an API that I can embed in my Java apps and run tests as normal Java tests. (Yeah, call me ignorant). The text has plenty of nice screenshots which make the tool seem easy to use. And at the end of Chapter 2 I quickly sought to learn more.
As expected we start the meat of the book by installing and running JMeter.
Then in Chapter 4 we jump into learning JMeter's concept of a Test Plan:
  • Threads - the groups of users  and actions
  • Samplers - controllers that let you do stuff
  • Logic Controllers - for control flow
  • Listeners which let you report on stuff
  • Timers for pausing and adjusting flow
  • Assertions for validation
  • Configuration Elements for changing the way samplers work
  • Various pre-processor and post processor elements
We also see and example of putting a Test Plan together for a functional (rather than a performance) test of a web site. This seemed like an interesting example and I left Chapter 4 with a  good basic understanding of how to write and automated script in JMeter.
I found the list of samples listed surprisingly large and I could guess most of the purposes from the names, but I had to go away and do some research to find out what the JUnit Request sampler did.
Rather than a weakness, I found that a strength of this book. It piques your interest very quickly and you then go away and research that point of interest rather than getting bogged down in the whole JMeter documentation.
For the uninitiated the "Junit Request Sampler" seems to act as a mechanism for performing load tests using JUnit tests - someone must have found a use for this - it doesn't seem to support the annotation style of JUnit and you have to extend the tests Junit TestCase. Interesting to know ... possibly.
In Chapter 5 we jump into an intro to Load/Performance testing of websites and we learn how to use the http proxy recorder to record scripts and amend it into a test plan, add listeners and timers. And then run it and examine the results. we also get teaser hints into remote testing with JMeter with targetted links into the JMeter documentation.
With chapter 6 we go back to Functional testing which I assume the author included to provide an easy example for changing the HTTP Headers and user defined variables. I certainly hadn't expected to learn how to use JMeter for functional testing but I found it interesting to learn that people used it in this way. Although I still don't belive that I would fire up JMeter for functional tests. (Sample this chapter is on the Packt page for the book)
Chapter 7 provides a very quick overview of some "advanced features" but not "advanced usage". This really means some of the logic controllers, different ways of getting user defined data into the tests regular expressions, testing databases, testing ftp. Again this acts as more of a 'teaser' chapter to get you to go and research more on your own.
And with "JMeter and Beyond" (chapter 8) we get a short summary of JMeter and a list of its Samplers, Listeners, Assertions and Timers. And then the book ends all too quickly. In fact just at the point that I got really interested, the book stopped. So I really want another volume which leads me into the depths of the tool in more detail. Either that or I just have to wait till I need to use the tool in earnest and start reading the documentation.
Although this very short book only provides and introduction to JMeter. I would love all test tools to have a book like this. If I had to use a performance test tool tomorrow I would pick JMeter, purely because of this book - I wouldn't even think of trying OpenSTA or WebLoad, because then I'd have to scramble around for some documentation and introductory tutorials.
This book really helps "demystify" automated testing and particularly the 'serious and technial' JMeter, making it seem easy. Hopefully this kind of book will help testers who consider themselves 'non-techy' to start doing techy things.
And for those of you, like me, that do count as techy - this just makes the first few steps even easier and faster.
As a negative - the books seems a little expensive for a basic introduction but I can't think of an easier way of starting to use JMeter.
Related Links: