Running a single function

During writing code or debugging a test, we, from time to time, would launch it in order to make sure that we are doing everything right and the test is working properly, according to our original intent.

Getting ready

Create a function, which executes a simple action (for example, enters a message into the log with the help of the Log.Message method).

How to do it...

In order to run a function, we will perform the following steps:

  1. Right-click on any place in the function that you would like to launch.
  2. Select the Run Current Routine option. In the result, the function will be launched. By default, for this option there is no predefined keys combination, however, we can easily create it if we wish to launch the function at a single key stroke.
  3. Now, select the Tools | Customize Keyboard... option.
  4. In the Categories list, select the Edit option.
  5. In the Commands listing, go for the Run Current Routine element.
  6. Click on the Press new shortcut key field and press the key or combination of keys which you would like to use to launch the current function. If the selected combination is already in use and thus reserved for another action, the name of the action will be displayed in the Shortcut currently used by field.
  7. Click on the Apply button.
    How to do it...
  8. If in the Keyboard mapping scheme field, the Default scheme has been selected, TestComplete will suggest creating a new one, since that scheme is a read-only one. Click on Yes and assign the name of the new scheme in the Create a New Keyboard Scheme window.

Now, we can launch the currently selected function with the use of the selected key or keys combination.

How it works...

We can only run those functions which do not accept parameters, otherwise the Run option will be disabled. The default keyboard mapping scheme always remains read-only so that we can easily roll back the changes if necessary.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.114.19