Forum Discussion

bdrummond's avatar
bdrummond
Contributor
7 years ago

Last Operation Result & Save to File is resulting in Blank

Hello all,

 

I am stuck on one bit of test complete's keyword test. Specifically, the Setting Variable value by using 'Last Operation Result' mode. 

 

As you can see in the image, I have a Log message keyword operation which I then want to set/assign it to the keyword test variable (Var1). I then try to use the Run Code Snippet to test is the Var1 variable is set, the result isn't promising : (

 

Is there something I did wrong here? seems the 'Last Operation Result' or the 'Set Variable Value' operation here isn't working.

 

The overall aim is to write/save the 'Last Operation Result' based on my Log.Message operation into a text file.

 

Any help would be much appreciated.

 

BD

 

  • The "Log.Message" operation doesn't return any value.  So, "Last Operation Result" is null or blank or empty.  That's why your variable isn't getting set to anything.  You should set the variable value before your first log message, log your message with the variable (no code snippet needed as you can pass the variable in to the text parameter on Message), and then use the variable to write to your text file.  I wouldn't use "Last Operation Result" at all.  That's used more on the lines of if you have some function or method or something that returns a value then use that value in some fashion in the next test step.  since Log.Message doesn't return a value, "Last Operation Result" doesn't make sense.

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    The "Log.Message" operation doesn't return any value.  So, "Last Operation Result" is null or blank or empty.  That's why your variable isn't getting set to anything.  You should set the variable value before your first log message, log your message with the variable (no code snippet needed as you can pass the variable in to the text parameter on Message), and then use the variable to write to your text file.  I wouldn't use "Last Operation Result" at all.  That's used more on the lines of if you have some function or method or something that returns a value then use that value in some fashion in the next test step.  since Log.Message doesn't return a value, "Last Operation Result" doesn't make sense.

    • bdrummond's avatar
      bdrummond
      Contributor

      hey there,

       

      thank you for your reply. "...since Log.Message doesn't return a value, "Last Operation Result" doesn't make sense" ak ok - i do see it now and what you have mentioned does makes sense. 

       

      I will try something else then. 

       

      cheers again for your help!

       

      BD