Articles

[Collapse]TestComplete/viewarticle/63445/
 [Expand]General Information/viewarticle/63445/
 [Expand]Using Help System/viewarticle/55799/
 [Expand]Getting Started Tutorial/viewarticle/56246/
 [Collapse]Using TestComplete/viewarticle/57875/
  [Expand]TestComplete User Interface, Projects and Settings/viewarticle/57876/
  [Collapse]Creating, Recording and Running Tests/viewarticle/56646/
   [Expand]Naming Objects/viewarticle/56265/
   [Expand]Creating Tests/viewarticle/57373/
   [Expand]Managing Tested Applications/viewarticle/57435/
   [Expand]Checkpoints and Stores/viewarticle/56266/
   [Expand]Running Tests/viewarticle/56462/
   [Expand]Handling Playback Errors/viewarticle/56641/
   [Collapse]Keyword Testing/viewarticle/55462/
     Keyword Testing in TestComplete - Overview/viewarticle/55568/
     Creating and Recording Keyword Tests/viewarticle/56528/
     Running Keyword Tests/viewarticle/56538/
     Getting Keyword Test Result/viewarticle/59461/
     Keyword Test Parameters/viewarticle/56869/
     Keyword Test Variables/viewarticle/56810/
     Converting Keyword Tests to Scripts/viewarticle/55497/
    [Expand]Creating Keyword Tests - Common Tasks/viewarticle/57285/
    [Collapse]Operations Reference/viewarticle/56529/
     [Expand]Checkpoints Category/viewarticle/55382/
     [Expand]Logging Category/viewarticle/56294/
     [Expand]Miscellaneous Category/viewarticle/62703/
     [Expand]Mobile/viewarticle/62688/
     [Expand]Statements Category/viewarticle/56298/
     [Collapse]Test Actions Category/viewarticle/56282/
       Call Object Method Operation/viewarticle/56275/
       Data-Driven Loop Operation/viewarticle/55559/
       Find Object Operation/viewarticle/57298/
       If Object Operation/viewarticle/57112/
       Menu Action Operation/viewarticle/58004/
       On-Screen Action Operation/viewarticle/55479/
       Process Action Operation/viewarticle/57955/
       Run Code Snippet Operation/viewarticle/56281/
       Run Keyword Test Operation/viewarticle/56527/
       Run Script Routine Operation/viewarticle/56271/
       Run Test Operation/viewarticle/56536/
       Run TestedApp Operation/viewarticle/55421/
      Frequently Used Category/viewarticle/55723/
     [Expand]Web Category/viewarticle/55679/
      Selecting Objects for Keyword Test Operations/viewarticle/56430/
   [Expand]Scripting/viewarticle/56245/
   [Expand]Test Visualizer/viewarticle/55007/
   [Expand]Exploring Applications/viewarticle/55055/
   [Expand]Debugging Tests/viewarticle/56567/
  [Expand]Test Results/viewarticle/55010/
  [Expand]Enhancing Tests/viewarticle/56964/
  [Expand]Teamwork and Integration Into QA Process/viewarticle/57266/
  [Expand]Extending TestComplete/viewarticle/57655/
  [Expand]Automating TestComplete/viewarticle/57438/
  [Expand]Best Practices/viewarticle/64008/
 [Expand]Testing Types/viewarticle/62721/
 [Expand]Applications Testing/viewarticle/62606/
 [Expand]Working With Application Objects and Controls/viewarticle/55815/
 [Expand]Samples and Tutorials/viewarticle/56239/
 [Expand]References/viewarticle/57878/
 [Expand]Other Tools That Help You Test Better/viewarticle/63442/
 [Expand]TestComplete 10 Licensing Guide/viewarticle/63451/
Updated: 7/15/2014 Applies To: TestComplete 10 Rating: No votes Click to rate: PoorNot badAverageGoodExcellent
Keyword Testing Operations: Test Actions Category

Run Code Snippet Operation

Description

Use the Run Code Snippet operation to execute a script statement or method call from your keyword test.

This operation is similar to the Run Script Routine operation. However, it lets you call script statements that are not a script routine. You typically use it when you need to call a method or property of an object that does not have a keyword test analogue and there is no need to create a script statement for this.

The called script statement must be a single-lined statement.

Operation Result

If the executed script statement returns a value (for instance, if the statement is a method call and the method returns some value), then the operation returns this value. For information on how to obtain this value, see Checking Operation Result.

If the executed script statement does not return any value, the operation has no result value as well.

Operation Parameters

The dialog that TestComplete displays to specify the operation parameters contains the edit box in which you can enter the desired script statement. TestComplete displays this dialog when you add the operation to your keyword test. You can also add an object to this statement. The way you add it depends on the object's type:

  • If the object is an on-screen window or control, then to specify it, you can click Select On-Screen Object and use the subsequent Select Object dialog to choose the desired window or control. See Selecting Objects for Keyword Test Operations.
  • If the object is one of TestComplete runtime objects, then to specify it, you can click Select Object and use the subsequent Select Runtime Object dialog to choose the desired object's name.
  • If the desired object's name is stored in a project suite, project or keyword test variable, then to specify it, you can click Select Variable and then use the subsequent Select Variable dialog to choose an existing variable or to create a new one.

To modify the parameters of the operation that was added earlier, simply double-click the operation row in the Keyword Test editor. TestComplete will invoke the same dialog that was shown when you added the operation to the test. Use this dialog to enter the desired script code.

See also
Test Actions Category | Specifying Operation Parameters | Checking Operation Result | Run Script Routine Operation


© 2014 SmartBear Software. All rights reserved.
Email Send feedback on this document