Debugging of the task

<< Click to Display Table of Contents >>

Navigation:  Several practical recommendations >

Debugging of the task

 

In this chapter we will consider some recommendations (guidelines) concerning the debugging of the generated task. If the task consists of 3-5 sequential steps, there is no need for debugging as a rule. But if there are more than 30 steps with loops and branching in the task (if .. then .. else), then there are surely hidden mistakes in it, that aren't visible ex facte.

 

By all means check the generated task by test example.

For lack of experience, it is difficult to reproduce the entire algorithm in the mind, and to write it as a task without any mistakes. To err is human.

Testing is necessary to check workability and correctness of the task. It is possible to check the implementation of the task, for example, by files of the test folder or by files which are easily restored from a backup copy.

The task can be invoked only after checking its correct working. Otherwise you may break working files. Or the task will not work in time, and you will not get a necessary result.

 

Output of values of variables into the log file or into the screen.

The task often works incorrectly because there is the wrong value in the variable: the empty value or the incorrect one.

In order to make sure the variables are filled in correctly it is possible to verify the values of variables before the implementation of the key actions. It can be done in the process of performing the task by several means:

Output of values of required variables into the screen before the implementation of the necessary action. You can use the action "Show message" for it.

Output of variable  values  or expressions into log of the task. Use the action "Log message".

 

As a text you can output one or several variables. For example:

{MyVar1}

{MyVar2}

 

Also you can output the whole expression if you use the composite value consisting of some variables. For example:

"{CurrentUser}" <{CurrentEmail}>

 

Using of local variables.

It is strongly recommended to use local variables in the task. Their advantage is that they "live" only while the task is being implemented, and they are visible only in the context of the implemented task.

Imagine the situation:

You have created a task by copying an existing task. After copying you change the task a bit. All variables in it are global by default. By some reason you have forgotten to change the names of variables. What will happen if both these tasks are implementing at a time? The result must be unpredictable. Both tasks can change the same variables. The algorithm of every single task will be broken.

We can avoid it easily if we use local variables. Choose the tab "Local variables" in the editor of the task and enumerate the variables used in the task, one by one into a line (see the chapter "Local variables").

The global variables are necessary only in two cases:

To transfer some data into another task.

To save a variable value between sessions of RoboTask.

 

In other cases you'd better use local variables.

 

note Related Topics

Local Variables

Running tasks simultaneously

Wait for Task