Concepts ›› Test Case Editor ››
Parent Previous Next


This page contains declarations of test local variables, and initialization of global and test local variables. Test local variables are created on the stack before test execution. They may be used as function parameters, when pointers or structures are needed. For example, for function

       void initStructT(struct_td * pStruct, long value);

we need the following local variable:

The two buttons between the tables can save us some typing. The first one copies all declared test local variables to the initialization table. The second one opens a wizard dialog, which helps us to add all array or structure members to the initialization table with few clicks:


Note, that we have to initialize each structure or array member separately.

Now we can use the declared and initialized variables as function parameters:


For character and number arrays we can specify contents with single entry. For strings we can use double quotes, for example:

     myChar     char[10]
     myChar     "Hello!"

For number arrays we can use curly braces, for example:

     myArray     int[10]
     myArray     {10, 20, 30, 40, 50, 60, 70, 80, 90, 100}


If function parameter is a pointer, we must make sure to assign pointer so that it points to valid memory area. For example, if function declaration is:

     void f(int *p);

and we declare variable:

     param1    int *

and then 'initialize' it like:

     *param1     10             // DON'T DO THIS!!!

then param1 will contain uninitialized address, depending on previous stack content. Symptoms: test will sometimes succeed, sometimes fail with error. Proper approach:


     param1    int


     param1    10

Function parameter:


Global variables

Global variables do not need declaration in testIDEA, because they already exist on the target and their address and type are already known from debug info. For example, global variable iCounter is initialized to value 10:

Global and function static variables keep their values between test runs - if a test changes value of the global variable, the next test will be executed with the changed value.

Warning: If we define type of a variable, it means a declaration of a local variable. If it has the same name as a global variable, the global variable is hidden!

Fully qualified names of global variables

When we have multiple download files, global variables from other then the default download file, require access with fully qualified name, which includes the download file name:






When we use such variable in expressions, the download file name is valid for whole expression, so we have to specify it at the end of expression, for example:

    iCounter == 3,,executable.elf

Function static variables

Syntax for static variables declared inside of a function, is the following:





Variables with the same type as function parameters

This section describes workaround for missing debug information or bug in compiler. Sometimes it may happen, that debug information contains wrong information or the type of function parameter is not named. For example, if a struct with two integers is typedefed, and the typedef is used as function parameter, some compilers do not provide the name of the typedef. In such cases winIDEA knows the parameter is a struct with two integers, but does not know the name of the type. This means we can not create a variable of the same type as function parameter. To solve this problem, we can use types of function parameters implicitly, when creating variables, by using keywords decltype or decltype_ref. The syntax is the following:


- functionName - name of the function
- N - index of function parameter, where 0 means function return value type, 1 is the first parameter, ...
- K - size of the declared array


  1. If the function is declared as:

void myFunction(MyStruct a)

we can use the following type instead of type MyStruct:


  1. If the function is declared as:

otherFunction(MyType *ptr)

and we want to create an array of 5 elements of type MyType to be used as a pointer parameter, we can write:


Note that type of the first function parameter is MyType *. We have to dereference it to get type MyType.

  1. If the function is declared as:

void f(int n1, int * pn2, int & rn3)

we can get parameter types using one of the following:


Returned type




type of 1st parameter (n1)


int *

type of 2nd parameter (pn2)



type of pointer



declares array to be used as the first parameter


int &

type of param3 (rn3)



referenced type of param2 (rn3)