Contributions
Re: Test if variables are passed to function
The method 'VariableExists' is only applicable to variables from the objects Project.Variables and ProjectSuite.Variables and based on your screenshot, those three variables are not Project or ProjectSuite Variables. If you need to check if some value has been passed to the variable (example in VBScript): Function MyFunc(Emp_Num, Start_Date, End_Date) if (Emp_Num= "") Then Log.Error("Variable Emp_Num is empty.") end if if (Start_Date= "") Then Log.Error("Variable Start_Date is empty.") end if if (End_Date= "") Then Log.Error("Variable End_Dateis empty.") end if . . . End function1.8KViews1like0CommentsJenkins - how to run a item test group
I'm using jenkins with the testcomplete plugin and i'm trying to execute a group of tests (GroupC). i've used the information provided in this link https://support.smartbear.com/testcomplete/docs/working-with/integration/jenkins/running-tests.html but it is not working, i've tried using folders and empty test items as a group organizer. This is the return error message: "Unable to create a project item of the 'Script Unit' type, because the specified file does not exist."Solved2.4KViews0likes3CommentsRe: NetUIHWND issues - Saving an Excel worbook
Have you tried to use the buttons shortcuts ? Something like this: Sys.Process('excel').Window('NUIDialog', 'Microsoft Excel', 1).Window('NetUIHWND', '', 1).SetFocus Sys.Desktop.Keys('~S') This willenters 'ALT + S' (Save)into the control with focus. Or just the second line if the window is already focused.3.6KViews1like1CommentDDT object not reading excel values properly
Hi all, I have several scripts that read data from excel sheets using DDT objects and i'm having problem with one of them. I can't explain the problem using just words so i made a little script (vbscript) to simulate the problem, i will be immensaly grateful if somebody can run this for me and try to understand. It's just 2 subs that do the exact same thing using different objects (DDT and WorkBook), read an excel sheet and log all values, it's supposed to generate the same result on both Subs. I'm also attaching 2 .XLS files, they are very similar, one works with DDT, but ther other don't. usingWorkBook -This one works, it read all values from all files properly usingDDT -This one read properly 'Sheet_B', but with 'Sheet_A' it read until some point, then just read 'null' (all last 4 values). TestComplete Version - 11.31.2420.7 You will need to edit the first line of each sub (variable 'FilePath') before running them. You just need to run the Sub usingDDT to simulate the problem, i created the other sub just to make sure it works and the problem was not in my .XLS file. Sub usingDDT FilePath = "C:\Users\leonardo\Desktop\Sheet_A.xls" ' Set objDDT = DDT Call objDDT.ExcelDriver(FilePath, "Plan1") line = 0 While Not objDDT.CurrentDriver.EOF line = line + 1 result = "" For Col = 0 To objDDT.CurrentDriver.ColumnCount - 1 Value = objDDT.CurrentDriver.Value(Col) ColName = objDDT.CurrentDriver.ColumnName(Col) If IsNull(Value) Then Value = "null" ' result = result & ColName & ": " & Value & " " Next Log.Message("Row : " & line & " " & result) objDDT.CurrentDriver.Next Wend objDDT.CloseDriver(objDDT.CurrentDriver.Name) End Sub Sub usingWorkBook FilePath = "C:\Users\leonardo\Desktop\Sheet_A.xls" ' Set XLS = Createobject("Excel.Application") Set WorkBook = XLS.WorkBooks.Open(FilePath) Set DriverSheet = WorkBook.Worksheets("Plan1") ' ColCount = DriverSheet.Usedrange.Columns.Count RowCount = DriverSheet.Usedrange.Rows.Count ' line = 0 For Row = 2 To RowCount line = line + 1 result = "" For Col = 1 To ColCount Valor = XLS.Cells(Row, Col) ColName = XLS.Cells(1, Col) If Valor = "" Then Valor = "null" ' result = result & ColName & ": " & Valor & " " Next Log.Message("Row: " & line & " " & result) Next ' XLS.Quit Set XLS = Nothing End Sub I'm missing something here ? Any help is greatly appreciated and sorry for the confusion. Edit: i'm attaching an image of the logs comparison after running the Subs reading the 'Sheet_A' file.Solved2.8KViews0likes4CommentsRe: How to check if process is closed?
You can trythe WaitProcess method. https://support.smartbear.com/viewarticle/73761/ Example: ; Open MyProcess if it is not already open If Not Sys.WaitProcess("MyProcess", 500).Exists Then TestedApps.MyProcess.Run() End If Edit: Here is a better example:https://support.smartbear.com/viewarticle/69092/1.3KViews1like1CommentRe: Trigger an event whenever a script is called
Thanks for the reply but this is exactly what i do not want to do. In thisway i have to call Preparation beforecalling any other method. Like this: Sub CallerFunction Call Preparation Call DoSomething1 Call Preparation Call DoSomething2 Call Preparation Call DoSomethingX End Sub In this specific script i have 38 methods and i got other scripts that will need something like this in the future. So i really wanted something like events. Thanks!1.3KViews0likes0CommentsTrigger an event whenever a script is called
Hi, i got some difficulties trying doing this. Whenever a method inside a script is called, i need to run a method that belongs to the samescript. It's something like this: Sub DoSomething1 *Code End Sub Sub DoSomething2 *Code End Sub Sub Preparation *Code End Sub Whenever i call DoSomething1 or DoSomething2 i want to call Preparation before. I do not like the idea of having to call Preparation in every method i create. Is there a way to use something like a event to trigger whenever a method inside this script is called? Sorry if i'm not being clear enough. Thanks!1.3KViews0likes6Comments