User Guide SilkPerformer Java Explorer 2006 Release 2 ®
Borland Software Corporation 20450 Stevens Creek Blvd., Suite 800 Cupertino, California 95014 USA http://www.borland.com Borland Software Corporation may have patents and/or pending patent applications covering subject matter in this document. Please refer to the product CD or the About dialog box for the list of applicable patents. The furnishing of this document does not give you any license to these patents. Copyright © 1992-2007 Borland Software Corporation and/or its subsidiaries.
Contents Introduction 1 How to Use this Guide . . . . . . . . . . . . . . 1 SilkPerformer SOA Edition Overview . . . . . . . 1 Tools Provided by SilkPerformer SOA Edition . . 3 Sample Applications for SilkPerformer SOA Edition6 Sample Test Projects . . . . . . . . . . . . . . . 9 Chapter 1 Java Framework Testing with SilkPerformer 11 Testing Java Components. . . . . . . . . . . . 11 Chapter 2 Setting Up Java Explorer Projects Overview . . . . . . . . . Creating a New Project . . Defining a Test . . . .
iv SilkPerformer Java Explorer User Guide
Introduction About this chapter This introduction serves as a high-level overview of the different test approaches and tools, including Java Explorer, Java Framework, .NET Explorer, and .NET Framework that are offered by SilkPerformer SOA (Service Oriented Architecture) Edition.
INTRODUCTION SilkPerformer SOA Edition Overview SilkPerformer SOA Edition license is required to enable access to component testing functionality. Users may or may not additionally have a full SilkPerformer license. Please see the SilkPerformer Components information site for more details. What can be tested With SilkPerformer SOA Edition you can thoroughly test various remote component models, including: • Web Services • .
INTRODUCTION Tools Provided by SilkPerformer SOA Edition Tools Provided by SilkPerformer SOA Edition SilkPerformer .NET Explorer SilkPerformer .NET Explorer, which was developed using .NET, allows you to test Web Services, .NET Remoting objects, and other GUI-less .NET objects. .NET Explorer allows you to define and execute complete test scenarios with different test cases without requiring manual programming—everything is done visually via point and click operations.
INTRODUCTION Tools Provided by SilkPerformer SOA Edition Alternately you can launch SilkPerformer Workbench: If you have SilkPerformer SOA Edition, go to: Start/Programs/Borland/ SilkPerformer SOA Edition 2006 R2/SilkPerformer SOA Workbench. If you have SilkPerformer Enterprise Edition, go to: Start/Programs/Borland/ SilkPerformer 2006 R2/SilkPerformer Workbench. Create a new project with the application type .NET/.NET Framework using Visual Studio .Net Add-On.
INTRODUCTION Tools Provided by SilkPerformer SOA Edition http://www-106.ibm.com/developerworks/java/ SilkPerformer Workbench Remote component tests that are developed and executed using SilkPerformer Java Explorer or SilkPerformer .NET Explorer can be executed within SilkPerformer Workbench. SilkPerformer Workbench is an integrated test environment that serves as a central console for creating, executing, controlling and analyzing complex testing scenarios. Java/.
INTRODUCTION Sample Applications for SilkPerformer SOA Edition existing clients, or by importing JUnit test frameworks or existing Java/.NET classes. A recorded test client precisely mimics the interactions of a real client. Note The recording of test clients is only supported for Web Services clients.
INTRODUCTION Sample Applications for SilkPerformer SOA Edition • Web Services • ASP.NET applications communicating with Web Services • WinForms applications communicating with Web Services and directly with .NET Remoting objects. To access the .NET Message Sample and related documentation: If you have SilkPerformer SOA Edition, go to: Start/Programs/Borland/ SilkPerformer SOA Edition 2006 R2/Sample Applications/.NET Framework Samples/.
INTRODUCTION Sample Applications for SilkPerformer SOA Edition Java RMI Samples Four Java RMI sample applications are included: • A simple RMI sample application that is used in conjunction with the sample Java Framework project Samples/Java Framework/RMI (see the following section, Sample Test Projects).
INTRODUCTION Sample Test Projects RMI Testing with RMI over IIOP A simple example server can be found at: \Java Explorer\SampleApps Launch the batch file called LaunchRemoteServerRmiOverIiop.cmd to start the sample server. Use Java Explorer’s Start Here Wizard to begin testing RMI objects. Select Enterprise JavaBeans / RMI over IIOP and click Next. The next step asks for the JNDI settings and a classpath where the RMI interfaces for the client can be found.
INTRODUCTION Sample Test Projects Java Sample Projects JDBC This sample project implements a simple JDBC client using the SilkPerformer Java Framework. The JDBC test client connects to the Oracle demo user "scott" using Oracle's "thin" JDBC driver. You must configure connection settings in the databaseUser.bdf BDL script to run the script in your environment. The sample accesses the EMP Oracle demo table. RMI/IIOP This sample project implements a Java RMI client using the SilkPerformer Java Framework.
1 1e rC t p a h What you will learn Java Framework Testing with SilkPerformer This chapter contains the following sections: Section Page Testing Java Components 11 Testing Java Components SilkPerformer’s Java Framework enables developers and QA personnel to coordinate their development and testing efforts while allowing them to work entirely within their specialized environments: developers work exclusively in their Java programming environments while QA staff work exclusively in SilkPerformer—there’s
1 JAVA FRAMEWORK TESTING WITH SILKPERFORMER Testing Java Components The Java Framework enables users to run stand-alone Java test code; to use other tools to invoke Java test code; or to execute test code from an exported standalone console. Working with JDK versions Because multiple Java Developer Kit (JDK) versions are available, testers need to test components against all versions.
1 JAVA FRAMEWORK TESTING WITH SILKPERFORMER Testing Java Components they are decoded and presented to the user. What you see as the return result of the method call is exactly what the server has sent over the wire via XML. The Java Explorer User Guide explains use of Java Explorer in detail.
1 JAVA FRAMEWORK TESTING WITH SILKPERFORMER Testing Java Components 14 SilkPerformer Java Explorer User Guide
2 2e rC t p a h What you will learn Setting Up Java Explorer Projects This chapter contains the following sections: Section Page Overview 15 Creating a New Project 16 Defining a Test 18 Understanding Test Cases 23 Overview This chapter shows you how to set up projects and define tests in Java Explorer. A sample Web Service hosted is used for demonstration purposes.See “Enterprise JavaBeans & RMI Over IIOP” for details regarding using Java Explorer to test Enterprise JavaBeans and RMI over IIOP.
2 SETTING UP JAVA EXPLORER PROJECTS Creating a New Project Creating a New Project Upon opening Java Explorer you are prompted to either open an existing project or create a new project. Procedure To create a new project: 1 Select the Create a new project radio button. 2 Enter a name for your project in the text field. Note The project name may not be longer than 19 characters and may not contain certain special characters (e.g., * . !). 3 Click OK.
2 SETTING UP JAVA EXPLORER PROJECTS Creating a New Project Overview of the interface The Java Explorer interface enables you to intuitively configure tests for Web Services, Enterprise JavaBeans, RMI, and other Java classes. The Java Explorer Start here workflow bar assists you in configuring and running your tests. The WSDL/JAR address field allows for the loading of either WSDLs or Java classes and packages.
2 SETTING UP JAVA EXPLORER PROJECTS Defining a Test The Output Data Properties field shows the properties of the output parameters (value, type, etc). The Test Scenario window lists the current test cases along with all added method calls. See “Setting Up Tests” for more details regarding the Java Explorer GUI.
2 SETTING UP JAVA EXPLORER PROJECTS Defining a Test Note When testing EJBs a dialog prompts you for EJB-specific connection settings. For other Java classes you must define a path to a Java archive or class file. 4 Click Next. The WSDL file, which is an XML description of the functionality that is offered by the Web Service, is loaded. Java Explorer can now determine what is available on the Web Service. Note The sample Web Service offers a minimum of functionality— it simply echoes back values.
2 SETTING UP JAVA EXPLORER PROJECTS Defining a Test 7 If required, you can change Web Service proxy and authentication settings for the Web server by selecting the Open (...) button and entering information on the Connection Settings dialog. a If required, enter the endpoint of the Web Service in the URL field. If user credentials are required for authentication, enter the information in the upper set of Username and Password fields. b Click OK to accept the settings. 8 Click Next.
2 SETTING UP JAVA EXPLORER PROJECTS Defining a Test Note Login and logout methods must be in first and last positions respectively. 11 The button between the Up and Down arrow buttons enables you to invert the selection of methods (i.e., all unmarked methods become marked, and vice-versa). 12 Click Next. 13 The final step is to select the test case in which the testing methods should be added. You can select from the following: • Init Test Case - This is the first test case that is called in test runs.
2 SETTING UP JAVA EXPLORER PROJECTS Defining a Test 14 Click Next. Note If you’ve selected a method that takes parameters, a dialog informs you that default parameters will be used for the method, which may result in an exception being thrown. If you don’t wish to proceed, click No. Then go back, deselect the method in question, and manually add it later with a more meaningful parameter value.
2 SETTING UP JAVA EXPLORER PROJECTS Understanding Test Cases The invoked method calls (service1.echoString and service2.echoFloat) have been added to the specified test case. Click a method call to view or edit its input/output parameters. Understanding Test Cases Following is an overview of the characteristics of test cases as they relate to Java Explorer. Each test scenario includes an Init test case and an End test case. Multiple Main test cases can be defined.
2 SETTING UP JAVA EXPLORER PROJECTS Understanding Test Cases Names of test cases are restricted. As they are mapped to Java methods and SilkPerformer transactions, they are subject to the restrictions of Java methods and SilkPerformer transaction names. Code exported to SilkPerformer cannot use keywords that are defined by BDL or Java.
3 3e rC t p a h What you will learn Setting Up Tests This chapter contains the following sections: Section Page Overview 26 Design View 26 Code View 30 Output View 31 Customizing Input Parameters 33 Storing Output Values in Variables 34 Manually Adding Global Variables 35 Defining Output Value Verifications 36 Adding & Updating Method Calls 40 Complex Input/Output Data 40 Random Variable Wizard 45 Enterprise JavaBeans & RMI Over IIOP 49 Testing RMI 64 Testing Java Archives 67
3 SETTING UP TESTS Overview Overview This chapter explains how to set up and customize your tests in Java Explorer. Topics include an introduction to GUI elements, customization of input parameters, definition of output value verifications, and generation of random variables. The chapter concludes with discussions about using Java Explorer to test EJBs and RMI over IIOP. Design View Design view (open by default) is the primary mode used to access the majority of Java Explorer’s functionality.
3 SETTING UP TESTS Design View Loaded Components Window The Loaded Components window, accessible via Design view only, distinguishes between classes and objects and displays these components on different trees. In Classes view you see all loaded classes with their members (methods and fields) that can be accessed without the need of an object context—so normally these are static functions, constructors, and fields.
3 SETTING UP TESTS Design View Web Services are treated as if they only have static methods. The following folders are available in Classes view: Remote Objects Home interfaces of Enterprise JavaBeans on remote servers are included in this folder. Home interfaces are looked up on a naming service via JNDI. Invoking a create method on EJB home objects instantiates EJB objects on servers. Web Services This folder lists stub classes, which are helper classes that encapsulate network communication.
3 SETTING UP TESTS Design View Objects view shows objects stored in variables that have global scope and those that have a local scope of the currently selected test case. Objects Objects contain logic and data. For example an object’s data might consist of a string. The object’s logic would then consist of functions that can be used to manipulate the string. Note By invoking a method more than once using different input parameters you can create new objects.
3 SETTING UP TESTS Code View Variables Depending on variable type—either simple value type or complex object— variables are either shown as simple types (no actions allowed) or as objects for which you can invoke all methods on the variable object (e.g., methods on java.lang.String). String values are represented as complex objects that allow you to call all methods of the java.lang.String class. Code View Code view displays generated code files for the current test scenario.
3 SETTING UP TESTS Output View JUnit code view This view displays the JUnit test script code. This code can be executed with any JUnit TestRunner. For more information about JUnit testing, please consult SilkPerformer Online Help. Client proxy code This view displays generated WebService Client proxy code. When loading a WSDL file to access a Web Service, a Client proxy class is created. Proxy classes are created on method and type information in WSDL files.
3 SETTING UP TESTS Output View Animation Log Animation Log view displays detailed information about test duration, method calls, and errors. It also lists each method, including input parameters and output values. Java Explorer automatically saves this file to \Working\Projects\\RecentTestRun\. log. Error Log The Error Log delivers detailed information about errors that occurred during the last test run.
3 SETTING UP TESTS Customizing Input Parameters Note Output view can also be accessed via the Results button on the Workflow bar. See “Animation Log” for more information. Customizing Input Parameters When to customize input parameters Input parameters should be customized prior to the execution of a method. If you want to customize a method call after it has been executed (e.g.
3 SETTING UP TESTS Storing Output Values in Variables - 2 If you don’t wish to use a constant value and would rather use a random value for types such as boolean, double, int, or string, you can create a new random value by selecting New random variable. See “Random Variable Wizard” for information regarding the Random Value Wizard. If a random value of the parameter type has already been created, select Use random variable and select the variable from the drop-down list. Click OK.
3 SETTING UP TESTS Manually Adding Global Variables Note The Output Value Wizard can also be launched by clicking the Customize button on the Workflow bar, or by right-clicking an output parameter in the Output Data pane. 2 In the Output Value Wizard, define a name for the output value variable in the Variable name field. 3 Define the scope of the variable. The default scope is Local, which means that the variable can only be used with the test case within which it has been created.
3 SETTING UP TESTS Defining Output Value Verifications Global variables can be used as input parameters for function calls. They are configured with an initial value, which makes them useful when you need to have the same value used for multiple function calls. Each time a test run begins, global variables are initialized with a defined initial value. Procedure To create a global variable: 1 On the Objects tab, right-click an object in the Objects tree and select New Global Variable from the context menu.
3 SETTING UP TESTS Defining Output Value Verifications Note See “Verification with NULL or variable” for details regarding this selection. 3 - Select Constant Value to verify that the value exactly matches a constant string. - If you are verifying against a string value you can verify against a Regular expression. - If you are verifying numeric values, you can select Range to verify that the value is within a specified range (using the From and To fields).
3 SETTING UP TESTS Defining Output Value Verifications 4 Verification with NULL or variable Click OK. The Verification with Null or variable selection includes a drop-down list that contains the entries and and a list of variables, that match the return value of the method call. The drop-down list also contains arrays for which the element type matches the return value of the method call.
3 SETTING UP TESTS Defining Output Value Verifications java.lang.String; so variables that represent a string array can be selected from the drop-down list. In such cases, an array index field is enabled. The Verification with NULL or variable drop-down list also contains public fields of complex objects of matching type. In the example below, the test class PublicMember has a public field called mStr of type string, which can be selected.
3 SETTING UP TESTS Adding & Updating Method Calls Adding & Updating Method Calls Procedure To add a method to a test case: 1 Within the Loaded Components or Method Call pane, select the method to be added and invoke it by clicking the Invoke button. The invoked method is then automatically added to the currently selected test case. If the method call returns a value, the Output Value Wizard will open automatically, prompting you to store the value.
3 SETTING UP TESTS Complex Input/Output Data 3 Arrays & objects as input data Specify the variable’s name and scope as described in “Storing Output Values in Variables”. When using an array from a variable as input data, the entire array can be taken from the variable or each field can be defined manually. 1 Select the complex input parameter in the Input Data objects tree. 2 Click the Input Value Wizard (...) button to open the Input Value Wizard.
3 SETTING UP TESTS Complex Input/Output Data 3 For example, you can specify that a variable be used as input. Array Input Data When a method requires an array as an input parameter, you can define the number of array elements and all elements in the array. Procedure To define array elements: 42 1 The default length for arrays is 1. To change the number of elements in an array, select the array node in the Input Data pane.
3 SETTING UP TESTS Complex Input/Output Data Java Explorer then automatically adds or removes the required elements. 3 To specify an element’s value, select an element in the array and specify the value in the Value field. 4 Array members or an entire array can be assigned input parameters from a variable. To specify input parameters from a variable, click the Input Value Wizard (...) button to open the Input Value Wizard.
3 SETTING UP TESTS Complex Input/Output Data 6 Using complex input data example Click OK. Following is an example of how to use complex input data. Procedure To use complex input data: 1 Call the method echoStringArray of the sample Web Service: http://demo.borland.com/BorlandSampleService/BorlandSampleService.asmx?WSDL (see “Using the Load File Wizard” for details). This service requires an object of the generated class ArrayOfString as a parameter.
3 SETTING UP TESTS Random Variable Wizard 3 Define the array elements by calling the method setString on the object. 4 Pass the variable to the echoStringArray method. Random Variable Wizard With the Random Variable Wizard, random variables can be configured for entire input parameters or the individual members of complex input parameters. The Input Value Wizard also enables you to reuse existing random variables.
3 SETTING UP TESTS Random Variable Wizard Alternative Alternately, if you’ve already configured a random variable that you’d like to apply, click the Use random variable radio button. All available variables are listed in the drop-down list. Select the variable you wish to apply and click OK. From the drop-down list, select the type of random variable you wish to have inserted into your script. A short type description and a variable declaration preview for each type is provided.
3 SETTING UP TESTS Random Variable Wizard Choose the variable type you wish to use as random variable from the Random type droplist. For this example, use Individual strings. Click Next to continue. Note This section only illustrates working with the Individual strings variable type. See SilkPerformer Online Help for more information regarding the use of random types. Random value types 4 In the Parameter pane, you can edit existing values, or insert new values.
3 SETTING UP TESTS Random Variable Wizard For each string value you must define a weighted number that indicates the probability that the string value will be chosen. Weighted numbers are integer numbers. Strings from a pattern Declares a random variable of type RndStr. With each access, such a variable contains a random string value. The characters of the string and the length of the string are generated randomly following a uniform distribution.
3 SETTING UP TESTS Enterprise JavaBeans & RMI Over IIOP Enterprise JavaBeans & RMI Over IIOP When testing components such as EJBs or other remote components, you can’t use HTTP traffic when the application expects RMI or RMI over IIOP traffic. To communicate with the application SilkPerformer must invoke a Java client that generates the appropriate protocols that can be used to approach the application’s interface.
3 SETTING UP TESTS Enterprise JavaBeans & RMI Over IIOP Note Protocol, host, and port comprise the naming service provider URL. You may also directly enter the complete provider URL in the Provider Url field. 6 If required by the provider, specify credentials in the User and Password fields. 7 Click the Edit Classpath (...) button to open the Classpath Configuration dialog.
3 SETTING UP TESTS Enterprise JavaBeans & RMI Over IIOP 9 Click OK. 10 Back on the EJB Wizard, click Next to connect to the naming service and open the Look up and narrow a Home Interface or Remote Object dialog. 11 Browse through naming service sub-folders and select an EJB Home interface (represented by a “hand holding a coffee bean” icon) or a remote object (represented by a satellite dish icon) for which Java Explorer should obtain a reference.
3 SETTING UP TESTS Enterprise JavaBeans & RMI Over IIOP 12 Click Finish to browse for the methods of the remote object using the Load File Wizard and to specify which test case the methods are to be called from. Note EJB’s which implement the EJBLocalObject interface instead of the EJBHome interface aren't displayed correctly in the JNDI tree.
3 SETTING UP TESTS Enterprise JavaBeans & RMI Over IIOP b Invoke one or more methods on the EJB object. Vendor-specific JNDI Settings Following are the application server vendor-specific default values for the settings on the Connect to Naming Service dialog (initial context factory, protocol, and port). Note that these values are inserted automatically when you select the appropriate Server name from the drop-down list. Note Protocol, host, and port comprise the naming service provider URL.
3 SETTING UP TESTS Enterprise JavaBeans & RMI Over IIOP Client Classpath: Enter all jar files and classpaths that are required for connecting to the EJB. This is where you usually put the client side stubs and additional classpath entries. Stubs are automatically generated by WebLogic servers when EJB’s are deployed. Verify your settings and click Next. The names of all registered EJB’s and RMI objects hooked into your WebLogic server will then be browsed.
3 SETTING UP TESTS Enterprise JavaBeans & RMI Over IIOP Select the home interface and click Finish. Confirm the next step by clicking Next. The selected home interface will then be browsed for its published methods. A method named create is likely to be among these. This method must be called to get a valid reference to an EJB object. Click Next and select the test case where Java Explorer should write code for the steps performed by the wizard.
3 SETTING UP TESTS Enterprise JavaBeans & RMI Over IIOP Information on how to call methods, define test cases and run animated tests can be found at Method Invocation , Test Cases and Animated Run . IBM WebSphere Context factory: com.ibm.websphere.naming.WsnInitialContextFactory Provider URL: iiop:// (no default port) Classpath Settings: Server Classpath: Add IBM’s implementation of J2EE plus additionally required packages that can be found listed in those jar files.
3 SETTING UP TESTS Enterprise JavaBeans & RMI Over IIOP - tx.jar - utils.jar - ejbportable.jar - The Properties directory (usually located within the WebSphere home directory). Client Classpath: Enter all jar files and classpaths that are required for connecting to the EJB. This is where you usually put client side stubs and additional classpath entries. Stubs are automatically generated by WebSphere servers when EJB’s are deployed.
3 SETTING UP TESTS Enterprise JavaBeans & RMI Over IIOP Select the home interface that allows for the creation of instances of EJB’s. It is typical for EJB’s to have home interfaces that are used to create EJB instances. In this example you’ll use CartHome (full JNDI name: ps/cart taken from the petstore sample) Select the home interface and click Finish. Confirm the next step by clicking Next. The selected home interface will then be browsed for its published methods.
3 SETTING UP TESTS Enterprise JavaBeans & RMI Over IIOP Click Finish and give a variable name to the EJB reference that was obtained by the Java Explorer Wizard. Click OK. You can now call any business methods of the EJB. Go to Java Explorer’s Object panel and find the EJB that was placed there by the wizard. Sun For the testing of Sun EJBs with Sun’s J2EE Implementation, the following settings must be specified: Context factory: com.sun.jndi.cosnaming.
3 SETTING UP TESTS Enterprise JavaBeans & RMI Over IIOP Client Classpath: Enter all jar files and classpathes that are required to connect to the EJB. This is where you usually put client side stubs and additional classpath entries. Stubs are automatically generated by Sun’s J2EE server on deployment. Verify your settings and click Next. The names of all registered EJB’s and RMI objects hooked into your J2EE server will then be browsed.
3 SETTING UP TESTS Enterprise JavaBeans & RMI Over IIOP Select the home interface and click Finish. Confirm the next step by clicking the Next button. The select home interface will then be browsed for its published methods. A method named create is likely to be among these. This method must be called to get a valid reference to an EJB object. Click Next and select the test case where Java Explorer should write code for the steps performed by the wizard.
3 SETTING UP TESTS Enterprise JavaBeans & RMI Over IIOP Click Finish and provide a good variable name for the EJB reference obtained by the Java Explorer Wizard. Click OK. You can now call any business methods of the EJB. Go to Java Explorer’s Object panel and find the EJB that was placed there by the wizard. Context factory: JBoss org.jnp.interfaces.
3 SETTING UP TESTS Enterprise JavaBeans & RMI Over IIOP Procedure To test SilkPerformer’s RMI sample: 1 Launch the Product Manager RMI sample (see “Java RMI Samples”). 2 Browse to the \SampleApps\RMILdap directory. 3 Invoke the four batch files (step1 through step4). 4 Launch the EJB Wizard as described in the previous section. The RMI objects are registered at a JNDI naming service. Use the EJB Wizard to browse for available Remote Objects.
3 SETTING UP TESTS Testing RMI The getProductsByName method requires a string as parameter. ’*’ is used as a wildcard to get all products. Testing RMI Java RMI can be achieved using two different protocols, both of which are supported by Java Explorer: • RMI over IIOP (see “Enterprise JavaBeans & RMI Over IIOP”) • Java Remote Method Protocol (JRMP) (see the following section) Note Sample RMI and RMI/IIOP projects are available. See “Java RMI Samples”.
3 SETTING UP TESTS Testing RMI 4 Click Next. 5 The next dialog asks for the RMI registry settings and a classpath where the RMI interfaces for the client can be found. Here are the settings to be used for the sample: - Host: localhost - Port: 1099 - Client Stub Class: \Java Explorer\SampleApps\lib\sampleRmi.
3 SETTING UP TESTS Testing RMI Click Next to see a tree of all registered remote objects in the RMI registry. Select RemoteServer and click Next. The methods of the remote object will then be browsed. Select the first two methods: - echoFloat(float) - echoString(String) These are the two methods that are implemented by the sample RMI server. The other methods are inherited from base classes and don’t need to be tested. Click Next and select the test case from which these methods should be called.
3 SETTING UP TESTS Testing Java Archives Testing Java Archives Java archives normally contain many classes that must be tested. Use the Start Here Wizard to begin testing Java archives. Select Java Archive and browse for the .jar file that contains the classes to be tested. To see how this works, load the sample archive (sampleBasic.jar) that ships with Java Explorer (this archive is selected by default). Click Next.
3 SETTING UP TESTS Testing Secure Web Services Click Next to create the instance and browse the created object for its methods. Select the object toString method. Click Next and select a test case where Java Explorer should add the created scenario. The method toString returns a string. Therefore, Java Explorer will ask you whether it should store the returned value or discard it. Test Class Wizard The Test Class Wizard allows you to create a test case for a class or an instantiated object.
3 SETTING UP TESTS Testing Secure Web Services way of downloading server certificates is to export them from your Web browser. Procedure To create a truststore for your JDK: 1 Export a certificate (.cer file) from your Web browser and export it to your local system (see your browser’s help system for instructions).
3 SETTING UP TESTS Testing Secure Web Services Working with Secure Web Service Calls Using Apache Axis 1.2.1 You must use Apache Axis 1.2.1 (or higher) to test secure Web services. Procedure To configure Java Explorer to use Apache Axis 1.2.1: 1 Select the menu Tools/Project Settings. 2 Select the Web Service Plugin tab. 3 Select Axis 1.2.1 from the Assigned Web Service Plugin list box. The selected Axis version is stored persistently in Java Explorer’s project file.
3 SETTING UP TESTS Negative Testing Web Service Emitter Timeout When generating Web service stub code for large WSDL files, the process of generating the Java source code may take longer then the default timeout specified by the Axis library. The following exception will be generated: com.segue.jexplorer.datatyp.exception.JExpWsdlException: Failed to generate Web Service proxy library(webAxisProxy1.jar).: Failed to create java source from WSDL.: java.io.
3 SETTING UP TESTS Negative Testing 72 SilkPerformer Java Explorer User Guide
4 4e rC t p a h What you will learn Animation Runs This chapter contains the following sections: Section Page Overview 73 Animated Runs 73 Ignoring Expected Exceptions 76 Overview Animated runs are test runs that execute all test methods assigned to your test cases with corresponding input and output data displayed in the Input Data and Output Data panes as they are submitted/received. Status symbols indicate the success/failure status of each method call after it’s run.
4 ANIMATION RUNS Animated Runs • Always run End Test Case • Run all Test Cases during Animated Run • Invoke Delay (time delay between method calls, in ms). Procedure To execute an animated run: 1 Click Run Test on the Workflow bar. The Animated Run dialog appears. Note Alternately, you can select Animated Run from the Run menu. 2 Select the test cases that should be executed during the test run (InitTestCase, TestCase, or EndTestCase). The default selections vary based on your option settings.
4 ANIMATION RUNS Animated Runs default (1), test cases will be executed the number of times defined in this property. If the number of method calls reporting an error exceeds the number of allowed errors defined in the test case properties, the test case will be aborted. Animated runs can be aborted manually by either clicking Ctrl+C on your keyboard or by selecting Stop Run from the Run menu.
4 ANIMATION RUNS Ignoring Expected Exceptions description of the failure in a ToolTip by moving your mouse over the failed method call. Ignoring Expected Exceptions Expected exceptions can be ignored during animated runs. A dialog is displayed whenever a method throws an exception. The dialog enables you to specify what you would like to have done with the method. You can either add the method call to the test case, or ignore the exception.
5 5e rC t p a h What you will learn Analyzing Tests This chapter contains the following sections: Section Page Overview 77 User Report 78 Error Report 81 Animation Log 81 Exploring Object Properties 82 Exploring Method Properties 83 Overview Once you have completed a test run, you can view three result files to assist you in analyzing the executed test.
5 ANALYZING TESTS User Report 3 Select the button that corresponds to the result file type you wish to generate. See explanations of each report type in the following sections of this chapter. Alternative Alternately, result files can be selected from Java Explorer’s Results menu, or by selecting the Output tab above the Loaded Components pane. User Report The User Report is based on SilkPerformer’s Virtual User Report.
5 ANALYZING TESTS User Report The Test Method Summary table offers information about each test method that has been called. You receive information about execution times and number of errors that occur.
5 ANALYZING TESTS User Report The Errors table gives you information about each error that occurs during the test run. You receive information about when each error occurred, which test methods caused the errors, and short descriptions of the errors.
5 ANALYZING TESTS Animation Log Error Report The Error Report delivers an overview of all errors that occur during test runs. You receive information about error time, the test case and test method with which each error occurred, severity types, and error messages. Animation Log The Animation Log (Output view) displays information about the methods that are called during test runs.
5 ANALYZING TESTS Exploring Object Properties also included. When exceptions are encountered, the Animation Log offers detailed stack traces for the exceptions. Exploring Object Properties Java Explorer enables developers and testers to explore the properties of objects. This is done by right-clicking an object in the Loaded Components pane (the Objects tab must be selected) and selecting Quick Info from the context menu. The Quick Info dialog displays the internal state of the selected object.
5 ANALYZING TESTS Exploring Method Properties • Click the Base Types button to display the parent classes of the object. Exploring Method Properties Java Explorer enables developers and testers to explore the properties of methods. This is done by right-clicking a method in the Loaded Components pane and selecting Properties from the context menu.
5 ANALYZING TESTS Exploring Method Properties • 84 Modifiers SilkPerformer Java Explorer User Guide
6 6e rC t p a h What you will learn System & Project Settings This chapter contains the following sections: Section Page Overview 85 Java Explorer Processes 86 System Settings 86 Project Settings 94 Overview Java Explorer offers a number of system and project setting options. For details regarding available project settings (runtime and classpath definitions) see “Project Settings”.
6 SYSTEM & PROJECT SETTINGS Java Explorer Processes Java Explorer Processes When Java Explorer is launched, at least two processes are run. The first process runs under SDK 1.4 and is responsible for displaying the Java Explorer GUI. The second process is the runtime process, which is responsible for instantiating and managing all Java objects that belong to the currently open project. The runtime process can run under any JDK, which is configurable via System Settings / Project Settings / Tools menu.
6 SYSTEM & PROJECT SETTINGS System Settings C:\j2sdk1.4.2_04. Click OK. This special JDK version can now be selected from any project. Note To enable a specific JDK version for a project go to the Tools menu, and select the Project Settings entry. This opens a dialog that allows you to assign the JDK version used for the current project. See “Project Settings” for details. Configuring IBM JDK (for WebSphere) Open the Tools menu and click the System Settings entry.
6 SYSTEM & PROJECT SETTINGS System Settings Default Value Settings The Default Values options tab enables you to change the default input parameter values for method calls. You can set default values for the following types: • boolean • double • int • string Boolean can either be True or False, double stands for all floating point numbers, int for all integer numbers. To define default input parameter values, simply edit the value in the right column of the parameter type you wish to change.
6 SYSTEM & PROJECT SETTINGS System Settings Verification Settings These options define the behavior of verifications: Automatically define a verification for stored values When selected, default verifications are defined whenever you store an output value in a variable. Ignore Case (Default value) This is the default value of the Ignore Case check box when verifying a string value in the Verification Wizard.
6 SYSTEM & PROJECT SETTINGS System Settings Invoke delay Defines the delay between the invocation of method calls in animated runs. History Loaded file entries Java Explorer tracks all classes, archives and WSDL URLs that have been loaded. So instead of typing the complete name of a test class, you can select an entry from the history list if the class has been loaded before. You can manage the entries in the loaded-file entries list.
6 SYSTEM & PROJECT SETTINGS System Settings 4 Click Yes on the confirmation dialog to delete the file entry. Connection Settings Connection options allow you to define the default proxy connection that should be used when communicating with a Web Service. The specified connection is also used when loading a WSDL from the Internet.
6 SYSTEM & PROJECT SETTINGS System Settings When a WSDL file is loaded, the Web Service class inherits the settings of the connection options. If these options are changed after the Web Service has been loaded, the changes won’t be reflected in the Web Service class. JUnit Settings JUnit settings enable you to select the TestRunner that is to be used when running JUnit tests.
6 SYSTEM & PROJECT SETTINGS System Settings combo box. The classpath panel enables you to specify the classpath information that is required to run the selected TestRunner.
6 SYSTEM & PROJECT SETTINGS Project Settings SilkPerformer Settings The SilkPerformer Home Directory and SilkPerformer Project Directory can be configured via the system settings’ SilkPerformer tab. Initial settings are detected by Java Explorer setup. Project Settings Runtime Settings To enable a specific JDK version for a project go to the Tools menu, and select the Project Settings entry. This opens the Runtime dialog that allows you to assign the JDK version used for the current project.
6 SYSTEM & PROJECT SETTINGS Project Settings Web Service Plug-In Settings Java Explorer supports Axis versions 1.1, 1.2.1, and 1.3 out of the box. To select a specific Axis library version for a project go to the Tools menu, and select the Project Settings entry. This opens the Runtime dialog that allows you to assign the Axis version used for the current project. In the Web Service Plugin tab, select an Axis library version from the drop-down list and click OK.
6 SYSTEM & PROJECT SETTINGS Project Settings Note The Runtime classpath is stored in both JExlorer.conf and the project file (.jep). Upon loading a project, if the classpath entries in the project file do not match the classpath settings in the system settings (JExplorer.conf), the system settings will override the stored project settings. The Restart Runtime Process checkbox fulfills two purposes. First, it signals, if recent classpath changes made by the user require the restart of the runtime.
7 7e rC t p a h What you will learn Exporting Projects This chapter contains the following sections: Section Page Overview 97 SilkPerformer Java Projects 98 JUnit Test Cases 99 Standalone Console Applications 101 Overview Once you’ve defined your test scenario you can either continue running tests in Java Explorer or you can export the underlying test code to the following environments: • SilkPerformer Java Framework Project Exporting to SilkPerformer allows you to run load tests based on the sc
7 EXPORTING PROJECTS SilkPerformer Java Projects 2 Specify a name and destination for the exported file, as indicated on the Export Project dialog. By default, projects are saved to Java Explorer’s project directory (\Working\Projects\) Note Ensure that you set the correct proxy in your SilkPerformer project settings if you are calling a Web Service on the Internet.
7 EXPORTING PROJECTS JUnit Test Cases Java Profile Settings will be saved in the SilkPerformer project file, so the same Java Runtime and classpath settings will be used in SilkPerformer as in Java Explorer. This enables the Java test class to be compiled in the SilkPerformer GUI. When starting a load test or a try script run, the Java compiler is automatically invoked, just like the BDL compiler. Exported Files: • SilkPerformer project file (.
7 EXPORTING PROJECTS JUnit Test Cases 100 4 The Open TestSuite in JUnit checkbox enables you to start the JUnit testrunner directly from the Java Explorer GUI. 5 Click OK to have Java Explorer confirm that the JUnit system settings are complete. If they are not, the System Settings dialog opens with the JUnit tab pre-selected. Here the TestRunner to be used when running JUnit tests can be selected from a drop-down list.
7 EXPORTING PROJECTS Standalone Console Applications Test case execution sequence Note that there are differences between the way that JUnit and Java Explorer run tests.
7 EXPORTING PROJECTS Standalone Console Applications Recording a console application 2 Specify a File name and destination Directory for the exported standalone console application as indicated on the Export Standalone Java Application dialog. 3 Click OK. By default, a .java and a .bat file are saved to the current project directory. 4 Open a command prompt in the folder to which you exported the application. 5 Run .
Index Symbols E .NET .NET 2003 4 .NET Explorer 3 .NET Message sample 6 .NET Remoting 2, 6, 9 Test drivers 2 Eclipse Plug-in 12 EJB Home object 49 EJB Wizard 51, 52 EJBLocalObject 52 End test cases 21, 74, 89 Enterprise JavaBeans 2, 4, 11, 17 Error Log 32 Error Report 77, 81 Errors 37, 80 Exceptions Ignoring expected 76 Exporting projects 97 A Add-In for Visual Studio .
Processes 86 Setting up projects 15 Java Framework 12, 98 Java Naming Service (JNDI) 49 Java Remote Method Protocol (JRMP) 64 Java RMI 6 Objects 2 Samples 8 Java test script (.
T Test cases 21, 74 Details & summaries 78 Global 29 Local 29 Main test cases 23 New 21 Understanding test cases 23 Test code 30 Test Scenario window 18 TestClass 96 TestRunner 92 Tests Analyzing 77 Defining 18 U URL (Endpoint) field 19 User Report 32, 77, 78 V Variables 30 Global 23, 35 Local 35 Random 34, 45 Storing output values in 34 Verifications 38, 40 Virtual User Report 78 W Web Services 2, 3, 4, 12, 18, 28, 91 Plugin settings 95 Public 6 Sample project 9 Testing secure Web services 68 WebLogic 5
106 SilkPerformer Java Explorer User Guide