Saving the test
Having recorded and edited our test we can now save it for later use. With Selenium IDE active choosing File
from the menu bar presents several options for saving tests. In this instance we will choose "Save Test As..."
Licensed to Menshu You
Zend Framework in Action (Ch01) Manning Publications Co. 12
which will save the test in the default HTML format we saw above. It can then be opened later and the test
repeated as needed.
10.3.2 Automating Selenium tests
In the previous example we recorded a single test and ran it completely inside the browser under what is called
Selenium's "test runner" mode. This is fine for single tests but to make ourselves truly productive, we need to
use Selenium RC which allows us to run multiple Selenium tests written in a programming language.
One of the supported languages is of course PHP which is available as "PHP - Selenium RC" when
choosing "Export Test As..." from Selenium IDE. Unfortunately, at the time of writing, the resulting
exported file contains code that is not only a little wordy but does not make use of the newer
PHPUnit extension PHPUnit_Extensions_SeleniumTestCase. Listing 10.9 shows a more efficient
rewrite of the our Selenium test as a PHPUnit test case.
Listing 10.
Pages:
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298