Inflectra Customer Forums: User Lib question (Thread) I have created a user library where I added the StartDynamics() function: /** Base Functions **/ function StartDynamics() { var dynamicsPath = "C:\\Program Files (x86)\\Microsoft Dynamics AX\\60\\Client\\Bin\\"; var dynamicsFullPath = dynamicsPath + "Ax32.exe"; var dynamicsQA = " \\\\DAX-RDS-101-WD\\AX_config\\QA_CUS.axc"; var windows = g_util.FindWindows("regex:.Microsoft Dynamics AX.*", "AxMainFrame"); if (!File.Exists(dynamicsFullPath)) { Tester.FailTest("Dynamics AX Client is not installed on this computer"); return; } if (windows.length == 0) { Global.DoLaunch(dynamicsFullPath, dynamicsPath, false); Global.DoSleep(10000); if (SeSFindObj('QA')) { SeS('OK1').DoClick(); Tester.Message('QA'); } if (SeSFindObj('Communication_error')) { SeS('OK2').DoClick(); Tester.Message('Communication error'); Global.DoLaunch(dynamicsFullPath + dynamicsQA); Global.DoSleep(15000); if (SeSFindObj('Communication_error')) { SeS('OK2').DoClick(); Tester.FailTest('Communication error'); } } Global.DoWaitFor('Home', 60000, 5000); } maximize('UIAutomation'); SeS('TabControl').DoSelectTab("Home"); } I call the function in the TestInit() function in all the tests: function TestInit() { StartDynamics(); } LibBase.jslib file: SeSRegisterLibrary( { name: 'Base', description: 'Base - Default user-defined library', include: 'Lib/LibBase/LibBase.js', info: null, load_order: 1000, recording: false, // Only use in playback. If it has recording rules then set it to 'true' autoload: true // Always load this library for this test and each subtest } ); The problem is that the tests occasionally fail on the line in TestInit() where I call the StartDynamics() function from the LibBase.js library with: TypeError(-2146823281): Handle is null or not an object and only if the Dynamics is not started. Now, my questions are: 1. Is TestInit() or TestPrepare() better for this kind of function? 2. Should I edit some parameters in the LibBase.jslib file so it reads the LibBase.js immediately on running (if that is the problem here) en-US(C) Copyright 2006-2024 Inflectra Corporation.support@inflectra.com/Computers/Software/Project_Management//Computers/Software/Quality_Assurance/KronoDesksupport@inflectra.comhttp://www.inflectra.com/kronodesk/forums/threads120/Support/Forum/rapise/issues-questions/1937.aspxthreadId=1937Dimitar Hristovski (Dimitar.Hristovski@interworks.com.mk)LibUser LibUser Lib question I have created a user library where I added the StartDynamics() function: /** Base Functions **/ function StartDynamics() { var dynamicsPath = "C:\\Program Files (x86)\\Microsoft Dynamics AX\\60\\Client\\Bin\\"; var dynamicsFullPath = dynamicsPath + "Ax32.exe"; var dynamicsQA = " \\\\DAX-RDS-101-WD\\AX_config\\QA_CUS.axc"; var windows = g_util.FindWindows("regex:.Microsoft Dynamics AX.*", "AxMainFrame"); if (!File.Exists(dynamicsFullPath)) { Tester.FailTest("Dynamics AX Client is not installed on this computer"); return; } if (windows.length == 0) { Global.DoLaunch(dynamicsFullPath, dynamicsPath, false); Global.DoSleep(10000); if (SeSFindObj('QA')) { SeS('OK1').DoClick(); Tester.Message('QA'); } if (SeSFindObj('Communication_error')) { SeS('OK2').DoClick(); Tester.Message('Communication error'); Global.DoLaunch(dynamicsFullPath + dynamicsQA); Global.DoSleep(15000); if (SeSFindObj('Communication_error')) { SeS('OK2').DoClick(); Tester.FailTest('Communication error'); } } Global.DoWaitFor('Home', 60000, 5000); } maximize('UIAutomation'); SeS('TabControl').DoSelectTab("Home"); } I call the function in the TestInit() function in all the tests: function TestInit() { StartDynamics(); } LibBase.jslib file: SeSRegisterLibrary( { name: 'Base', description: 'Base - Default user-defined library', include: 'Lib/LibBase/LibBase.js', info: null, load_order: 1000, recording: false, // Only use in playback. If it has recording rules then set it to 'true' autoload: true // Always load this library for this test and each subtest } ); The problem is that the tests occasionally fail on the line in TestInit() where I call the StartDynamics() function from the LibBase.js library with: TypeError(-2146823281): Handle is null or not an object and only if the Dynamics is not started. Now, my questions are: 1. Is TestInit() or TestPrepare() better for this kind of function? 2. Should I edit some parameters in the LibBase.jslib file so it reads the LibBase.js immediately on running (if that is the problem here) Wed, 07 Nov 2018 15:35:40 -05002018-11-09T10:41:53-05:00/Support/Forum/rapise/issues-questions/1937.aspxmessageId=3439Max K (denis.markovtsev@inflectra.com) Hi Dimitar, I think that TestInit is a good place to call StartDynamics. I suggest to run the test Hi Dimitar, I think that TestInit is a good place to call StartDynamics. I suggest to run the test with Internal Debugger and step into StartDynamics function to find out where it fails (I believe it is successfully executed from TestInit). I also suspect that the failure is in maximize function you call in the end of StartDynamics. Regards, Denis Fri, 09 Nov 2018 08:04:38 -05002018-11-09T08:04:38-05:00/Support/Forum/rapise/issues-questions/1937.aspx#reply3439messageId=3440Dimitar Hristovski (Dimitar.Hristovski@interworks.com.mk) maximize is a very simple function. function maximize(window) {     SeS(window).getDesktopWindow( maximize is a very simple function. function maximize(window) {     SeS(window).getDesktopWindow().Maximized = true; } Ill try it with Internal Debugger and post the results Fri, 09 Nov 2018 09:57:11 -05002018-11-09T09:57:11-05:00/Support/Forum/rapise/issues-questions/1937.aspx#reply3440messageId=3441David J (support1@inflectra.com) I would recommend logging as a help desk ticket if you need more help as we dont check the forum po I would recommend logging as a help desk ticket if you need more help as we dont check the forum posts as frequently. Fri, 09 Nov 2018 10:21:03 -05002018-11-09T10:21:03-05:00/Support/Forum/rapise/issues-questions/1937.aspx#reply3441messageId=3442Dimitar Hristovski (Dimitar.Hristovski@interworks.com.mk) Hi, This happens rarely, but if this keeps on repeating and we dont find what causes it, I will ra Hi, This happens rarely, but if this keeps on repeating and we dont find what causes it, I will raise a ticket. Fri, 09 Nov 2018 10:41:53 -05002018-11-09T10:41:53-05:00/Support/Forum/rapise/issues-questions/1937.aspx#reply3442