This procedure describes creating a native test step.
Follow these steps:
This class implements the runtime logic of the test step. See the JavaDocs in the doc folder of your installation directory for TestNode and the sample code that is provided for FTPTestNode in the samples that accompany this document. The following calls are important for the construction of a test step:
public void initialize( TestCase test, Element node ) throws TestDefException
DevTest invokes this call for you to read the parameters you require for the operation from the test case XML DOM. As the test case is constructed, it is passed with the DOM Element of the step that represents this node in the test case XML.
public void execute( TestExec ts ) throws TestRunException
This is called when your test step logic is invoked. The workflow and state engines manage most of the control flow and data requirements for you. You can access the TestExec given as a parameter to perform various tasks. See the JavaDocs TestExec and the description of this class in Integrating Components.
To create and edit your node, provide a controller and viewer in the MVC pattern. The TestNodeInfo class is the base class for all test steps that are developed for DevTest. The authoring framework executes this class to interact with your test step data and logic. See the JavaDocs for TestNodeInfo and review the example class that is provided, named FTPTestNodeController.
This class provides DevTest with the actual user interface for viewing and editing your node data. The authoring framework constructs and calls this class to display your parameters, verify their validity, and save your changes back into the TestNodeInfo extension. This CustomEditor extends JPanel in the Java Swing API. See the JavaDocs for CustomEditor and view the sample code for help writing your own editors.
public String generateName() { return "FTP " + getFile(); }
public String generateName() { FTPTestNode ftp = (FTPTestNode)getAttribute( FTP_KEY ); return ftp.generateName() }
Copyright © 2014 CA Technologies.
All rights reserved.
|
|