Forum Discussion
djadhav
Regular Contributor
Could you post a couple of scripts that are supposed to return a value?
jgoetz
9 years agoOccasional Contributor
Here is ideally the script that I would use, but when it gets to the if Eval.... to get the results from running the script, the script runs, but it always goes to the else even though the script that was called passed.
Sub testSuiteRun(scriptRunType, customerType, runComponentArea) Dim excelApplication, projectPath Dim sheetName 'Open and set Excel objects, spreadsheet, sheet, row count and column count Set excelApplication = Sys.OleObject("Excel.Application") projectPath = Project.Path Set book = excelApplication.Workbooks.Open(projectPath & "Test Data\TC_Script_Run.xlsx") sheetName = runComponentArea Set sheet = book.Sheets(sheetName) rowCount = sheet.UsedRange.Rows.Count colCount = sheet.UsedRange.Columns.Count tcCount = 1 excelApplication.DisplayAlerts = False 'Loop through rows of spreadsheet ignoring the header row For r = 2 To rowCount 'check if active row = run type and customer type If (sheet.Cells(r, 1) = scriptRunType And sheet.Cells(r, 2) = customerType) Then 'Loop through component script columns For c = 4 To colCount 'Set test case name to the header cell (row 1) for active column and the run indicator for active column and row testCaseName = VarToString(sheet.Cells(1, c)) runInd = VarToString(sheet.Cells(r, c)) 'Check if test case name is not blank for active col to eliminate extra blank columns If testCaseName <> "" Then 'check if run indicator is Y and if so then call that component script If runInd = "Y" Then If Eval("KeywordTests." + testCaseName + ".Run") Then sheet.Cells(r, c) = "P" Else sheet.Cells(r, c) = "F" End If book.Save End If End If Next End If Next 'quit excel excelApplication.Quit excelApplication.DisplayAlerts = True End Sub
I have also tried a very simple one like the following and what is returned to the log is blank.
Sub Test_Run_JG() Dim Var1, LastResult Var1 = "" 'Set LastResult = KeywordTests.Global_Login.Run LastResult = KeywordTests.Global_Login.Run Var1 = LastResult 'Posts an information message to the test log. Call Log.Message(Var1, "") End Sub
- djadhav9 years agoRegular Contributor
Are you using the return option in your script as described here?
- joseph_michaud9 years agoModerator
As djadhav asks: 'What value do the called tests return?" Try logging the returned value in the called test.
Related Content
Recent Discussions
- 4 hours agojstaehlin
- 21 hours agoAivanitskiy