ContributionsMost RecentMost LikesSolutionsRe: How to test in script if an ADO RecordSet object has returned records or not ?Seems to have solved the isuse with using the EOF property: //ok function ratesInserted(date) { var Cmd, RecSet, Prm; Cmd = ADO.CreateCommand(); Cmd.ActiveConnection = connectCWN(); // Specify command type and text Cmd.CommandType = adCmdText; Cmd.CommandText = "select 1 as inserted from dbo.ExchangeRates where (ValidDate = ?)"; // Create accountnum parameter Prm = Cmd.CreateParameter("@ValidDate",adVarChar, adParamInput); // Specify the parameter value Prm.Size = 30; Prm.Value = date; Cmd.Parameters.Append(Prm); // Execute the command RecSet = Cmd.Execute(); if (RecSet.EOF == false) { Log.Message("true"); return "true"; } else { Log.Message("false"); return "false"; } Cmd.ActiveConnection.Close(); } Just in case it is encountered by someone else ... Best Regards, Ilija How to test in script if an ADO RecordSet object has returned records or not ?Hi Everyone, I have the following procedure which should check if records in a table have been inserted for a given date with a simple query ( select 1 as inserted from dbo.ExchangeRates where ValidDate = '2012-09-05' ): function ratesInserted(date) { var Cmd, RecSet, Prm; Cmd = ADO.CreateCommand(); Cmd.ActiveConnection = connectCWN(); // Specify command type and text Cmd.CommandType = adCmdText; Cmd.CommandText = "select 1 as inserted from dbo.ExchangeRates where (ValidDate = ?)"; // Create accountnum parameter Prm = Cmd.CreateParameter("@ValidDate",adVarChar, adParamInput); // Specify the parameter value Prm.Size = 30; Prm.Value = date; Cmd.Parameters.Append(Prm); // Execute the command RecSet = Cmd.Execute(); if (!RecSet.Fields(0).Value.Exists) { Log.Message("false"); return "false"; } else { Log.Message("true"); return "true"; } Cmd.ActiveConnection.Close(); } The problems is that the RecSet always alsways has a property RecSet.Exists = true whether it returns an empty data set or not which is what I need to check in the if condition. If using !RecSet.Fields(0).Value.Exists or !RecSet.Fields(0).Value == null it fails when the RecSet is empty because there is no BOF EOF Third attempt was to use the RecSet.BOF property but this is alwayds treue as well . which is kind of weird and in contradiction to the above I would really appreciate if you can help me out which property or method of RecSet to use in order to check if it returns a data set . Best Regards, Ilija Cannot return string value from ADO object output parameterHi Everyone, I have the following function with an ADO object which invokes a SP and returns an output parameter for use in tests: function getMenuIndex(MenuDesc, ParentDesc) { var SProc; var idx; SProc = ADO.CreateADOStoredProc(); SProc.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog= " + Project.Variables.config.Value("cwn_db") + ";Data Source= " + Project.Variables.config.Value("cwn_server"); SProc.ProcedureName = "qp_test_GetMenuIndex"; // Adding an in parameter: SProc.Parameters.AddParameter(); SProc.Parameters.Items(0).name = "MenuDesc"; SProc.Parameters.Items(0).DataType = ftFixedChar; SProc.Parameters.Items(0).Size = 32; SProc.Parameters.Items(0).Value = "Customer Data Registration"; // Adding an in parameter: SProc.Parameters.AddParameter(); SProc.Parameters.Items(1).name = "ParentDesc"; SProc.Parameters.Items(1).DataType = ftFixedChar; SProc.Parameters.Items(1).Size = 32; SProc.Parameters.Items(1).Value = "Register Customer Data"; // Adding an out parameter SProc.Parameters.AddParameter(); SProc.Parameters.Items(2).name = "OutParamName"; SProc.Parameters.Items(2).DataType = ftFixedChar; SProc.Parameters.Items(2).Size = 32; SProc.Parameters.Items(2).Direction = adParamOutput; SProc.Parameters.Items(2).Value = null; // Running the procedure SProc.ExecProc(); // Obtaining the return value Log.Message(SProc.Parameters.Items(2).Value) //ok idx = SProc.Parameters.Items(2).Value; //not ok return idx; } The Log.Message(SProc.Parameters.Items(2).Value) confirms that the correct value SProc.Parameters.Items(2).Value has been returned by the SP: Type Message Time Priority Has Picture Link "[2]|[0]|[1]|[0]" 10:58:07 Normal However the return at the end of the ADO always returns a partial value "[2] in the tests instead of the whole string "[2]|[0]|[1]|[0]" : mainForm.StripMainMenu.Click(Database.getMenuIndex('Customer Data Registration', 'Register Customer Data')); output: Type Message Time Priority Has Picture Link The control item '"[2]' not found. 11:41:09 Normal If I replace the parameter inside Click() with the string "[2]|[0]|[1]|[0]" from Log.Message in the ADO function everything works fine. Getting out of options here, so I would really appreciate some help :-) Thanks a lot, Ilija P.S. Tried to replace ftFixedChar with ftString in the output paramter with no success. URL included in default Name Mapping for ASP.NET Web PagesHi, We are facing an issue with the name mapping of pages of a ASP.NET MVC web applicaiton. The default name mapping is always including the installation specific property URL which means that it is not possible to run the project on another instance of the same web applicaiton and prevents us from deplotying it in production. Please check attached screenshot for more detail. If the URL is removed the rest of the properties of the page shown in the right window are not providing enough information for a unique mapping, which makes it impossible to recordi new tests by having more than one item in Name Mapping reffreing to the same page like ins screenshot name_mapping items. Would be really gratefull if you can help us out on this issue Best Regards, Ilija Re: Project variables of string type getting empty between testsYes, after some further investigation I managed to nail down the issue to Runner.CallMethod() However another problem arises is that the number of variables passed through CallMethod must be fixed and in the strictly specified order, not like the usual args, argv[] syntax when passing parametars in traditional programming languages. Since the Project .Variables used are global in scope it does not make sense to pass them like parameters when calling functions, seems much better to use them whenever neccesary inside the functions which I will try doing today. Thanks a lot for the support, IlijaRe: DDT with Project Test itemsHere is the solution: function runTestItemRoutine(TestItemLevel) { if (TestItemLevel.ElementToBeRun != null) { var caption = TestItemLevel.ElementToBeRun.Caption.split("\\"); if (caption[0] == "Script") { var script = caption[1].split(" - "); if (script[1] != "Main") Runner.CallMethod(script[0] + "." + script[1], user, password, accounts); } } } You need to pass all project variables( Ex, user, password, accounts) used in the some of the recursive scripts as parameters to the Runner.CallMethod (Value, param1, param2 , ...) as in the above example. Hope this helps if someone has the same issue. Best Regards, Ilija Re: DDT with Project Test itemsFurther investigation has shown that no matter if the variables are of Object type and initialized in main() or any other script in the recursion, they are becoming empty once passed to another test. I moved the initialization code to unit Init as on the screenshot without success. Because of the above it can be concluded that the error is in the recursion script: //USEUNIT Database function Main() { var Driver; Driver = DDT.ExcelDriver("c:\\logon.xlsx", "MKD", true); RecNo = 0; Database.resetPass(); while (!Driver.EOF()) { recursiveTraverse(Project.TestItems); Driver.Next(); } DDT.CloseDriver(Driver.Name); } function recursiveTraverse(Level) { var Items = Level.ItemCount; for(var i = 0; i <=(Items-1); i++) { runTestItemRoutine(Level.TestItem(i)); recursiveTraverse(Level.TestItem(i)); } } function runTestItemRoutine(TestItemLevel) { if (TestItemLevel.ElementToBeRun != null) { var caption = TestItemLevel.ElementToBeRun.Caption.split("\\"); if (caption[0] == "Script") { var script = caption[1].split(" - "); if (script[1] != "Main") { Runner.CallMethod(script[0] + "." + script[1]); } } } } function recursiveTraverse(Level) { var Items = Level.ItemCount; for(var i = 0; i <=(Items-1); i++) { runTestItemRoutine(Level.TestItem(i)); recursiveTraverse(Level.TestItem(i)); } } function runTestItemRoutine(TestItemLevel) { if (TestItemLevel.ElementToBeRun != null) { var caption = TestItemLevel.ElementToBeRun.Caption.split("\\"); if (caption[0] == "Script") { var script = caption[1].split(" - "); if (script[1] != "Main") { Runner.CallMethod(script[0] + "." + script[1]); } } } } and Init contains: function Init() { user = DDT.CurrentDriver.Value('user'); Log.Message(user); password = DDT.CurrentDriver.Value('password'); Log.Message(password); accounts = Database.getAccounts(user); Log.Message(accounts); } If anyone has managed to recursively run Test Items with a DDT driver and use project variables at the same time, help will be greatly appreciated Thanks in Advance, Ilija Re: Project variables of string type getting empty between testsI even tried with user and object variables of Object type and that doesn't work as well:-(. For sure there must be something wrong with the recursive function function Main() { var Driver; Driver = DDT.ExcelDriver("c:\\logon.xlsx", "MKD", true); RecNo = 0; while (!Driver.EOF()) { user = DDT.CurrentDriver.Value('user'); Log.Message(user); password = DDT.CurrentDriver.Value('password'); Log.Message(password); accounts = Database.getAccounts(user); Log.Message(accounts); recursiveTraverse(Project.TestItems); Driver.Next(); } DDT.CloseDriver(Driver.Name); } function recursiveTraverse(Level) { var Items = Level.ItemCount; for(var i = 0; i <=(Items-1); i++) { runTestItemRoutine(Level.TestItem(i)); recursiveTraverse(Level.TestItem(i)); } } function runTestItemRoutine(TestItemLevel) { if (TestItemLevel.ElementToBeRun != null) { var caption = TestItemLevel.ElementToBeRun.Caption.split("\\"); if (caption[0] == "Script") { var script = caption[1].split(" - "); if (script[1] != "Main") { Runner.CallMethod(script[0] + "." + script[1]); } } } } Otherwise the project variables can be passed without any problem but when the same tests usign them are called in the recursive function they are becoming empty. Any help is appreciated. Thanks in advance, Ilija Project variables of string type getting empty between testsHi to All, I'm opening this topic in relation to issue described in http://community.smartbear.com/forum/post/?mode=singleThread&thread=a4082b03-4d2c-4ab5-9131-3f4383b0e4dd I have two project variables getting filled form a DDT driver in the main() recursive function cycling through the test items as described in the post above, but when I passed them to tests in the recursion they are empty. otherwise I have been using the same variables without the recursion and seem to work fine. Would really appreciate if someone can take a look at what is causing this problem Thanks, IlijaRe: DDT with Project Test itemsI assume it has to do something with the dafult and local value, after cheking it the default value is " " and local value has the right values, but cannot figure it out ...