Example of Creating and Running a Test
This section provides an example of creating and running a Java test in both embedded and stand-alone (server) mode. It uses the com.arbortext.e3.E3AppTest Java application, which is sample code provided in the PE_HOME/e3/samples/java subdirectory. Refer to Programmer's Reference for information on creating Java applications.
To test a Java application in embedded mode:
1. Start Arbortext Publishing Engine Interactive by choosing it from its shortcut on your program group.
2. Choose > .
3. Click New Test in the window.
4. Select Java as the test type in the Test Type dialog box.
5. In the Java Test Editor, double-click on the class entry in the Query String list.
6. Assign a value of com.arbortext.e3.E3AppTest in the Modify Value dialog box, and then click OK.
7. Click OK in the Java Test Editor.
8. The test you created is now listed in the Test List dialog box. Select this test, and click Run Test. Because you are running in embedded mode, this test runs in Arbortext Publishing Engine Interactive and does not require that the Arbortext PE server is running.
The Results window should display a Reason Code of 200, a content-type header value of text/html, and, as the Output File Content, an XHTML page containing the result of the Java application that you executed. In this case, this content (normally viewed by a web browser) displays some diagnostic information about the request and the Java Virtual Machine (JVM) in which it ran.
9. Click Close to dismiss the Results window.
10. From the Test List dialog box, choose > and save this test to disk as sampletest.xml. If you want to reopen this test, choose > .
This procedure shows how to run the Arbortext Publishing Engine Test Utility in stand-alone (server) mode. It uses the test you created in the embedded mode procedure, and executes the application on a running Arbortext PE server instead of in a simulated Arbortext Publishing Engine environment.
To test a Java application in stand-alone mode:
1. Start the Arbortext Publishing Engine Test Utility by typing the following command and arguments from within the PE_HOME\e3\bin directory at a command prompt:
e3test -l testlog.txt -f sampletest.xml
where
◦ -f sampletest.xml specifies the test file you created in the embedded mode example above.
◦ -l testlog.txt specifies that logging output will be written to the testlog.txt file.
2. Choose > .
3. Choose the Server test mode option if it is not already selected.
4. Enter the appropriate URL for your running Arbortext PE server in the PE Server URL field, following the format:
http://server-name:port/e3/servlet/e3
5. Click OK.
6. Select the test in the Test List dialog box, and then click Run Test. Since the Arbortext Publishing Engine Test Utility is operating in stand-alone mode, the test invokes (using HTTP) the Java application on the running Arbortext Publishing Engine server.
The Results window should display a Reason Code of 200, a content-type header value of text/html, and, as the Output File Content, an XHTML page containing the results of the Java application that you executed. In this case, this content (normally viewed by a web browser) displays some diagnostic information about the request and the Java Virtual Machine (JVM) in which it ran.
7. Click Close to dismiss the Results window.
|
After you close the Results window, you can view the testlog.txt file you created when you opened the Arbortext Publishing Engine Test Utility (using the -l option).
|