Almost half a year now I work for Post Finance in Berne. During this time I had to face several new challenges. Here you can find one of the more interesting ones:
Performance-Testing with Selenium
For a client side performance analysis often used GUI interactions shall be automated and executed in parallel. Unfortunately we were not able to control the JSF web application by means of the HtmlUnit Library. Thus we had to resort to Selenium. Selenium which (in the typical case) controls a concrete browser, e.g. IE, Firefox etc. To reduce the footprint of a single browser we chose the use of the PhantomJS browser. This Webkit based browser is headless but works apart from this like a common web browser.
You may now object that Selenium is a poor choice for performance tests. I agree with you: There are a bunch of tools which allow to run parallel clients with rather little computer power. These tools work with the capture/replay approach. In our case this had not worked since we have secured communication which we could not / don’t wanted avoid. As a plus we had not to simulate ten-thousend of parallel clients. At the end we managed to execute the test with this setup although we needed a 64 core machine using lots of memory.
Facts:
- Developing the test software was rather cumbersome and took a lot of time. I ran into lots of
Stale...Exception
which I needed to optimize away. We had even cases where the browser was unavailable. As last resort we had to repeat lots of operations and check if the result is now OK or not. In SW development this is normally not the way to go 😉 - Though PhantomJS is headless it does not mean it does not gobble up memory and spend performance. (Spliting up the browser to different machines would have been possible but would introduce additional communication.)
- Overcome the security constraints were not easy as well. Normally PhantomJS does not (yet) allow to add client certificates. Additionally I had to acquire a file-based certificate. Something that is normally prohibited in PF.