The first step when building a test case through a recording is recording the test
case. To start this, press → . Then select the
HTTP Recorder wizard in the folder Test/Recording and press
.
Specify the location and the name of the recording file in the next dialog. In this
example select HTTP Recorder project as
location and set the name of the recording file to
bookingExampleLogin. The error marker at the
project name can be ignored, is does only warn that the project has no configuration
until now. The configuration file will be created convenient to the test case, that is
generated automatically after the recording.
After pressing the recording starts: A web browser is opened automatically, under Windows® this will be an Internet Explorer.
![]() | Clear the cache of your browser. |
|---|---|
|
The resulting test case of your recording expects a behavior that is matches the traffic between the browser and the server. If the browser has cached files, the responses of the servers may differ from those when the caches are empty. To make the result of the recording reproducible, clear the browser's cache before recording a test case. |
From now on everything that is done with the browser is recorded and will be used to
generate a test case. For this example specify the
http://seam.demo.jboss.com/home.seam in the location bar of the
browser.
Fill in the login data you have specified previously when working on Section 12.1, “Preparations” and click "Account Login".
If the login was specified correct, the first page of the sample application will be
displayed as in Figure 12.5, “The login page of the sample application”.
After that follow the Logout link in the upper right corner of the sample application. You will reach the login page of the application again.
Now switch to the PETA-Designer and stop the recording by pressing the
(
) button in the
Recorder Control view of PETA-Designer.
![]() | Stopping the recording |
|---|---|
|
The recording must be stopped through the button in the Recording Control of PETA-Designer. If the browser window is only closed, the proxy settings of the browser are set to the wrong value. This results in a non-working browser, and at the next recording the error message
will be displayed. To solve the problem reset the proxy configuration in your browser. |
After the recording has been stopped, the test case generator generates various files:
The
bookingExampleLogin.rec
file contains the capture of the communication.
The
bookingExampleLogin.recmodel
contains information about the recording.
The
bookingExampleLogin.testSuite file
contains information about the execution of the test case, if it is deployed on
remote clients. Although this file has its principal task in the PETA-Load
component, it can be useful for navigating to the associated test cases and the
configuration. Figure 12.7, “The Overview tab of the
.testsuite file”
shows the
.testsuite file that was generated from the recording. The
associated configuration associated to the test run can be opened by clicking
the button next to the
Configuration field in the
Configuration section in the right column.
Clicking on a test case in the test case section opens the Test
Cases tab of the
.testsuite file. Here a test case can be selected and opened by
clicking the button.
In the src folder, the
package test is created and contains the class
BookingExampleLogin.java . This file
is also required for the PETA-Load component.
In the folder peta/configuration
a subfolder
generated is created that contains a new configuration named
bookingExampleLoginTest.xml , that
defines all actors that have been involved in the recording.
In the folder peta/case a
subfolder generated is created
that contains a new test case. It is named
bookingExampleLoginTest.xml .
The folder peta/template
contains a new folder
generated/bookingExampleLogintest that
contains the templates that are used by the test case. These templates are
named according to the events in the test case that uses them.