New tricks for SeleniumControl and SeleniumTestCase
Posted: November 12, 2007 Filed under: JSF, Selenium, Unit Testing, UnitTest 2 CommentsSince the original post introducing SeleniumControl and SeleniumTestCase these two classes learned some more tricks.
The most annoying thing I noticed about that code was, that I had to trigger the SeleniumTestSuite to be able to run a testcase. So I added a simple method to SeleniumControl (isStarted() returning true if server != null) to allow a testcase to query for that and, in case of need, to start the SeleniumServer on its own. The TestCase class checks for this in its setupBeforeClass()-method…
Now I can start either a SeleniumTestSuite, which results in the server started only once for the whole testsuite, or a SeleniumTestCase, which starts the server just for that single testcase. At the beginning the restriction did not hurt, only with the evolution of the test-suite (about 125 tests so far…) this started to itch.
After a few testcases I also added a method to SeleniumTestCase to open the web-applications root:
public boolean openAndWaitWebAppRoot() { boolean result = false; try { selenium.open(getWebAppRoot()); selenium.waitForPageToLoad(pageTimeOut); result = true; } catch (Throwable t) { result = false; System.err.println("--- received an exception: " + t); } return result; } public String getWebAppRoot() { return testHost + testAppl; }
very nice post. thanksss . please continue.
[url=http://www.gatorsportsnation.com]florida gator forum[/www.gatorsportsnation.com]
Thanks for the cudos.
I definitely want to continue to investigate into Selenium, just gotta find the time during the project development, because only real life experience teaches the important tricks.