Tag Archives: cd

How to setup Test Load Balancer in Windows

If you are using cucumber for automation, have hours worth of automation to run, TLB can reduce your automation execution time by optimising the parallelisation. In other words, if your automation takes 1 hour to run sequentially, using TLB you can make it run in 10mins if you want depends on how many partitions/balancer processes you use on same or different machines.

The real benefit is, if you are already doing or planning to do Continuous Integration and then Continuous Delivery so the  smoke/acceptance automation execution time after every checkin can be reduced phenomenally. This youtube video gives a clear picture of how to run TLB.

I’ll let you read the concepts and mechanics behind TLB at their project site and let me concentrate on writing how to make TLB work in Windows with cucumber.

Windows OS used in my case is Win XP Pro Service Pack 3.

Ruby version is 1.9.3

I did a Proof Of Concept that TLB works with cucumber automation on Mac Pro and it was seamless but when I tried it on Windows, there were many hurdles to pass and in this blog I’ll list out the steps to successfully make TLB (0.3.2) work in Windows. The work arounds/hacks mentioned in this blog will be available as part of 0.4 release of TLB so no need to hack around if you are using 0.4. All steps are applicable if you are using Ruby 1.8.7 and greater. If you are using JRuby, steps 5-13 are NOT necessary.

  1. make sure you have JRE 1.6 –  java -version should give the status , if not you can get it from here
  2. Download TLB from here – as of 11th July 2012, tlb-complete-0.3.2.tar.gz is the latest which comes with some examples cucumber projects as well
  3. Install the following gems
  4. gem install tlb-cucumber
  5. gem install win32-open3-19 (tlb 0.3.2 documentation does not mention this)
  6. gem install open5 (tlb 0.3.2 documentation does not mention this)
  7. Edit <ROOT>\ruby\1.9.3-p194\lib\ruby\gems\1.9.1\gems\tlb-core-0.3.2\core\lib\tlb.rb
  8. Add “require ‘open5′” to the top of the file (of course, remove the double quotes 🙂 )
  9. Replace “@pid, input, out, err = Open4.popen4(server_command)” with
  10. “input,err,out, @t= open5(server_command)” and
  11. “@pid=@t.pid”
  12. In the class “class ForkBalancerProcess” there is a method called “die”
  13. in that method, comment the statement “Process.wait”
  14. Edit <ROOT>\ruby\1.9.3-p194\lib\ruby\gems\1.9.1\gems\tlb-cucumber-0.3.2\cucumber\lib\tlb\cucumber\lib\run_data_formatter.rb
  15. replace line 33 containing code < args[0].file > (in method feature_file) to read < args[0].file.gsub(‘\\’,’/’) >
  16. Save the files, start TLB server <ROOT>\tlb-complete-0.3.2\server\server.bat start (or server.bat cleanup before start if server was killed)
  17. run the balancers using run_balancer.bat files

Errors to look for:

When you trigger the automation via balancers if you see and error “fork() call not implemented in this machine” then you haven’t done some or all of the above steps correctly

Thats all folks!