Ask a Question

TC: Array in KeywordTest

mooitc
Occasional Contributor

TC: Array in KeywordTest

Hi,

how can I implement these VBScript lines in KeywordTest?

Sub INIT_ICO
Project.Variables.ICO_XX = "09"
For Each i In Array(Project.Variables.ICO_XX)
ProjectSuite.Variables("APP_" & i) = "APP_" & i
Next
End Sub
3 REPLIES 3
rraghvani
Valued Contributor

Does your script actually work?

What output are you expecting?

mooitc
Occasional Contributor

Hi rraghvani,
thanks for the tip, here is the correction:

Sub INIT_ICO
'Project.Variables.ICO_XX = "09"
'Project.Variables.APP_XX_NAME = "notepad"
For Each i In Array(Project.Variables.ICO_XX)
Project.Variables("APP_" & i) = Project.Variables.APP_XX_NAME
Log.Message(Project.Variables("APP_" & i))
Next
End Sub
rraghvani
Valued Contributor

You have your variables already defined in the project. In your keyword test use the For Loop statement with Code Expression for Array(Project.Variables.ICO_XX). Use Code Expression again for Project.Variables("APP_" & i) = Project.Variables.APP_XX_NAME, and then use Log to output the variable.

You can convert your keyword test to scripts, and see if it matches with what you have written.

cancel
Showing results for 
Search instead for 
Did you mean: