Forum Discussion
aldebaran
15 years agoOccasional Contributor
Hi Alex,
I believe I have a similar problem! Depending on the result in a script test I set global variables. I want to do this so I don´t have to worry about if the test-suite is executed on a developers machine or the auto-testing machine with testexecute.
Here`s a code snippet:
Set objNetwork = CreateObject("WScript.Network")
strComputerName = objNetwork.Computername
strCheckVal = "UT-"
Erg = Instr(1, strComputerName, strCheckVal)
If Erg <> 0 Then
' if not equal to 0 we must be on build-server
Project.Variables.AppDir = SomeDir
Project.Variables.DatabaseName = "Bauhaus"
Project.Variables.DBCleanerDir = "C:\mut\TcDbCleaner"
Project.Variables.Entwicklungsrechner = False
Else
' if 0, must be developer´s machine
Project.Variables.AppDir = someOtherDir
Project.Variables.DatabaseName = "TCDB" SartoriusMembranTC
Project.Variables.DBCleanerDir = "..\..\..\..\TestCompleteDBCleaner\bin\Debug"
Project.Variables.Entwicklungsrechner = True
End If
It all works nicely and above Script is executed only once. The global variable "Project.Variables.DatabaseName" however is used before each individual keywordtest. It is passed a commandline-argument to a tool the cleans and inserts testdata. At some stage during the testrun that variable is set back to it´s default value and I cannot figure out when or why?
any suggestions are appeciated
greetings
Carsten
I believe I have a similar problem! Depending on the result in a script test I set global variables. I want to do this so I don´t have to worry about if the test-suite is executed on a developers machine or the auto-testing machine with testexecute.
Here`s a code snippet:
Set objNetwork = CreateObject("WScript.Network")
strComputerName = objNetwork.Computername
strCheckVal = "UT-"
Erg = Instr(1, strComputerName, strCheckVal)
If Erg <> 0 Then
' if not equal to 0 we must be on build-server
Project.Variables.AppDir = SomeDir
Project.Variables.DatabaseName = "Bauhaus"
Project.Variables.DBCleanerDir = "C:\mut\TcDbCleaner"
Project.Variables.Entwicklungsrechner = False
Else
' if 0, must be developer´s machine
Project.Variables.AppDir = someOtherDir
Project.Variables.DatabaseName = "TCDB" SartoriusMembranTC
Project.Variables.DBCleanerDir = "..\..\..\..\TestCompleteDBCleaner\bin\Debug"
Project.Variables.Entwicklungsrechner = True
End If
It all works nicely and above Script is executed only once. The global variable "Project.Variables.DatabaseName" however is used before each individual keywordtest. It is passed a commandline-argument to a tool the cleans and inserts testdata. At some stage during the testrun that variable is set back to it´s default value and I cannot figure out when or why?
any suggestions are appeciated
greetings
Carsten
Related Content
- 2 years ago
- 11 months ago
- 6 years ago