In this tutorial, you create and manipulate a simple Java object and use the java.util.Date class to create a date object.
First, you construct the object and review how to call methods on the object. Then you incorporate the object into a simple DevTest model editor.
Tutorial Tasks
In this tutorial, you:
Prerequisites
To create a test case:
The Dynamic Java Execution test step lets you create a Java object from a class in the DevTest classpath. In the following procedure, you use the java.util.Date class.
Follow these steps:
The Add step menu is displayed.
The Dynamic Java Execution editor opens.
The Complex Object Constructor wizard appears. The first step shows the available constructors.
The Complex Object Editor opens.
Now you have a Java object to manipulate in the Complex Object Editor.
The Complex Object Editor is divided into two panels. The left panel contains the Object Call Tree, which tracks method invocations and their input parameters and return values. The following icons are used to identify the branches in the object call tree:
The type (class) of the currently loaded object, followed by the response from calling the 'toString' method of the object.
The Constructor that was called. This icon is shown if multiple constructors exist.
A method call that has not been executed.
A method call that has been executed.
The input parameters (type and current value) for the enclosing method.
The return value (current value if the call has been executed) for the enclosing method.
The contents of the right panel vary depending on what is selected in the left panel.
To call the Java object:
The Call Sheet tab shows the available methods that you can call.
The setYear() method is added to the Object Call Tree. The right panel now displays the Call tab and Docs tab.
The Call tab lists the argument information.
You can add an inline filter from the Complex Object Editor. Inline filters (and assertions) do not result in a filter being added to the test step in the elements panel. Inline filter management is always done in the Complex Object Editor.
Follow these steps:
The right panel now displays the Call tab and Docs tab.
You can display the Property Window to verify that the Date_prop property was created.
Follow these steps:
In this tutorial, you:
Copyright © 2014 CA Technologies.
All rights reserved.
|
|