Testing Task Flows - adfemg/task-flow-tester GitHub Wiki

#Specifying Input Parameter Values For every task flow input parameter, you can use an EL expression to specify a value. The tester runs in the memory scope of the unbounded task flow, so you can reference any managed bean that you defined in your adfc-config.xml in the EL expression. You can also use all other common ADF EL expressions, for example #{securityContext.userPrincipal.name} to get the name of the logged in user or #{securityContext.userInRole['Administrator']} to test role privilege if you have secured your application using ADF security.

If you do not use an EL expression, then the way you specify the input parameter value depends on the input parameter class, as explained in the subsections below. If no class name is specified with task flow input parameter definition, then the tester defaults the class to java.lang.Object.

##Specifying Primitive Type Values For the following input parameter classes you can directly enter a value that will be auto-converted to the correct type: java.lang.Integer, java.lang.String, java.math.BigDecimal, java.lang.Long, java.lang.Short, java.lang.Double, java.lang.Float, java.lang.Boolean, java.lang.Character, java.lang.Byte, oracle.jbo.domain.Number

##Specifying Date Values If the input parameter class is a date type (java.util.Date, oracle.jbo.domain.Date or oracle.jbo.domain.TimeStamp), you can enter a date value using the format dd-MM-yyyy.

##Specifying oracle.jbo.Key Values If the input parameter class is oracle.jbo.Key, you can specify the value of the key attribute. If the key object is a composite key existing of multiple attributes, you can specify a comma-delimited list of key attribute values. Note that the values must be specified in the same order as the attributes are defined in the key.

##Specifying Map Values If the input parameter is of type java.util.Map or java.util.HashMap, you can use the edit icon to launch a dialog to construct the map.

In the dialog you can use the Add Map Entry button to add multiple entries. Based on the class name you enter an edit icon will appear allowing you to add complex or (nested) map types as a map entry.

##Specifying Complex Type Values If the input parameter type is not one of the types discussed above, you are dealing with a so-called complex type, typically a custom Java class with a number of properties.

Here is the code of the sample class we will use:

Since this Java class has a public no-arguments constructor, you can use the edit icon to launch a dialog to construct the complex type.

All the properties of the MyContext class with a public setter method are displayed. As you can see the property can be a map or complex type itself, allowing you to use a nested dialog editor to specify the map or complex type values. The tester supports an unlimited number of nesting levels to specify complex types.

##Specifying java.lang.Object Values If the input parameter type is not defined, or set to java.lang.Object, you need to use the edit icon to launch a dialog where you can enter the class name you want to use for your parameter value.

If you then enter a primitive type, a date type or oracle.jbo.Key as the class name, you can click OK to close the dialog again so you can enter the value directly in the input parameter field.

If you enter a map type as class name, you can also click OK to close the dialog, and if you then click the edit icon again, the map editor dialog will be launched. If you enter a complex type as class name, then all properties that have a setter method in the class appear when you tab out the class name field. See [Specifying Complex Type Values] for more info.

##Using your Own Java Code to Set Up Parameter Values As you have learned from the above descriptions, the tester provides a sophisticated mechanism to specify simple to very complex input parameter values. If this mechanism is not sufficient for your specific test case, for example because you need to instantiate a complex type that does not have a public no-arguments constructor, then you can write your own task flow parameter setup Java class with simple getter methods for the various task flow parameters. Register this class as a managed bean in the adfc-config.xml, and you can simply use an EL expression that references the appropriate getter method in your set up class to set up the parameter value.

#Running a Test After you specified the task flow input parameters (if any), or you selected a previously saved testcase, you are ready to run a test. If you are testing a task flow with page fragments you have a number of run options you can set:

  • Stretch Layout: If the page fragments in the task flow are set up to stretch the layout vertically, you can check this checkbox to test the stretching. If you uncheck this checkbox, you can see how the layout will be when the task flow is embedded in a page that has a flowing layout at the insertion point of the ADF region. If the page fragments in your task flow having a flowing layout, the value of the checkbox doesn't matter for your test.
  • Run in Region: If you select this option, the task flow will be directly embedded as ADF region in the lower right side of the tester page.

Run as Task Flow Call: If you select this option, a launcher task flow embedded as ADF region in the lower right side of the tester page will call the task flow you want to test. While this visually will give the same result as the "Run in Region" option the difference is that you can now also test the task flow return values and navigation outcome if you perform an action in the test task flow that navigates to a task flow return activity.

When testing a task flow with pages, you do not have run options. The task flow will always be run in an inline dialog window (a task flow call with the run-as-dialog option is used under the covers). Whether the pages stretch vertically or not is determined by how the pages in the task flow are set up. If you perform an action in the test task flow that navigates to a task flow return activity, the dialog will close automatically and return values (if any) as well as the navigation outcome will be displayed.

Unless you explicitly terminate the task flow you are testing by navigating to a task flow return activity, you need to click the Reset button before you can re-test the same task flow or testcase. The reset button will clear the state of the task flow so that the next run is not influenced by pending state of the previous run. If you click on another task flow or testcase in the tree menu, the state is automatically cleared and you do not have to click the Reset button.

#Saving Task Flow Testcases If you want to save a combination of task flow input parameters and run options you can do so by clicking the Save As... button.

If you click OK, after entering a name for the testcase and optionally a description, the testcase will appear in the tree menu at the left. Clicking on a testcase in the tree menu will prepopulate the input parameters with the values as set when you saved the testcase.

Note that you saved the testcases for the duration of the session. If you undeploy your application and run the tester again, the tree menu will be empty. Fortunately, you can export and import testcases and you can also start the tester with preloaded task flows and testcases. See section [Adding, Loading, Importing and Exporting Taskflows and Testcases].