简体   繁体   中英

Pass Variables to SilkTest Workbench stw.exe from Command Line

Variables are not recognized

I hava a Silk Test Workbench.Net Script called Dummy

Public Module Main
  Public Test As String = "test"
 
  Public Sub Main()
    msgBox(Test)
  End Sub
End Module

I want to run stw.exe using Command Line and override the variable Test :

stw.exe -dsn silktest -username user -password password -script Dummy -variable "Test=hello world"

Following the instruction from the example for using stw.exe .

But the cmd return an error that said the variables are not recognized

The following variables were not passed into 'Dummy' as they are not recognized:
->test

Any wrong from my code? Or is there any way to access the variables from.Net Script by command line?

You need to use a different function prototype for the Main() function that takes the arguments as a dictionary, for example.

Public Module Main
  Public Test As String = "test"

  Public Sub Main(args as IDictionary(Of String, Object)
    Test = args("Test")

    msgBox(Test)
  End Sub
End Module

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM