I'm trying to use the following code to get the current date to set a field in my test: var currentDate=aqDateTime.Now(); var dateTime=aqConvert.DateTimeToFormatStr(currentDate); When I try to ...
tristaanogre Here is what I'm using to try to set the field with the value received from the variable. I'm setting the variable in the Variables page of a keyword test.
OK... first, you should leave the default value of your variable blank. Code is not evaluated on that page so anything you may enter there in the way of code is simply stored as a string. This is why it's being entered as a string in your contorl. To evaluate a code expression and assign it to a variable, you need the Set Variable Value operation
When you drag that into your keyword test, you'll get a dialog that asks you to select your variable. Select the one you created and click Next
When you click Next, you'll be prompted to choose the Mode for your parameter. Set it to "Code Expression"
Once you select code expression, you'll have a field where you can enter your code expression. You should enter it as I had above where you just enter the expression to be evaluated and don't include any "=" to assign anywhere.
This is how you set a variable to a code expression in a keyword test.