Integrate Testcomplete (Python) Core Framework with Nexus / JFrog Artifactory Repository
Hi All, We are trying tocentralising the Testcomplete Framework (Python Code with in-built methods of Testcomplete) outside the Testcomplete Editor in-order toimplement "Central Repository" similar to Maven Dependency for Java. Kindly let me know if anyone has implemented Centralising the Framework and use it as a Dependency in the Testcomplete Project. Please assist me on how to centralising the Framework Code & access testcomplete in-built methods. Much appreciated for your help in advanced.Solved3.1KViews0likes7CommentsCalling a TestComplete method from external application
Hello, I have a TestComplete project with a python script, wich is testing an application (Application A). My plan is it, to call a function out of the TestComplete testing script from another C# application. C# application (B) Python TestComplete script Application A push button in application A ---> pushButton() ---> *button gets pushed* Is there an elegant way to do this? Like some kind of Interprocess Communication. I know that there is a REST API, but because both applications run on the same computer this would not be nice solution. I hope you could understand my plan 😄 Greetings LeonSolved1.7KViews0likes6CommentsPython external libraries and when any external methods are called, TC falls into infinite loop
Hi, I tried using OpenPyxl and then when I'm trying to run certain methods and for handling excel values. This happens for very first time, and when we rerun the same script to run after the first successful result, TC doesn't execute and doesn't respond, have to kill it from task manager to run it again Sample Script used is def ExcelWriteSingleCell(Sheet,Cell,Value): excelPath = "path" wb = openpyxl.load_workbook(excelPath ) ws = wb.get_sheet_by_name(Sheet) mycell=ws[Cell] mycell.value = Value running the above method once will result properly, whereas rerunning the same will result in infinite loop state or TC not responding state def testExcel(): Log.Message(ExcelReadSingleCell("Sheet1", "D3")) Log.Message(ExcelReadSingleCell("Sheet1", "D4")) Log.Message(ExcelReadSingleCell("Sheet1", "D5")) Log.Message(ExcelReadSingleCell("Sheet1", "C3")) Log.Message(ExcelReadSingleCell("Sheet1", "C5"))Solved1.5KViews0likes3CommentsSteps to Import Python Library in TestComplete
Hi All, Youtube - Import Python Library in TestComplete I've prepared a step to import python library using Openpyxl library inside test complete. Ref Step 1: Install python 3.6 – TestComplete 14.4 Support 3.6 Ref:https://www.python.org/ftp/python/3.6.0/ Check for Python version in Cmd : python –version Step 2: Download the python library matching the Python version.Ref:https://www.lfd.uci.edu/~gohlke/pythonlibs/ Install Numpy/Openpyxl library in the system Install in cmd line as “pip install Openpyxl” In Command Prompt type “Import Openpyxl” If you don’t get any error then the python library is installed correctly. Step 3: Navigate to default python installed location Eg: C:\Users\UserName\AppData\Local\Programs\Python\Python36 2. Copy all the files to TestComplete path Eg: C:\Program Files (x86)\SmartBear\TestComplete 14\Bin\Extensions\Python\Python36 Step 4: Set your environment variable of python path to Testcomplete path Eg: C:\Program Files (x86)\SmartBear\TestComplete 14\Bin\Extensions\Python\ Step 5: from os import sys import sys sys.path.append(“C:\\Program Files (x86)\\SmartBear\\TestComplete 14\\Bin\Extensions\\Python\\”) openpyxl_location = “C:\\Program Files (x86)\\SmartBear\\TestComplete 14\\Bin\Extensions\\Python\\Python36\\Lib\\” sys.path.insert(0, openpyxl_location) import openpyxl from openpyxl import Workbook Ref:https://vallatestcomplete.wordpress.com/2020/06/01/testcomplete-python-library-import/ Regards Valla4.4KViews4likes2CommentsHow does Python work in TestComplete
Im new to the TestComplete tool & I have been learning Python (I have basic Python knowledge) I would like to see some example of a test script which include setting an object, using click, verifying etc... to understand how Python works with TestComplete.Solved1.6KViews0likes6CommentsUsing .ClickItem() to set dropdown takes too long, but .value doesn't fire onChange in the browser.
Hello, I've been beating my head against the wall on this one for some time now. I'm trying to use TestComplete to create an set of automated tests that will run nightly to see if anyone "broke the build" for our very large web application. The biggest issue at the moment regards the setting of values for ComboBoxes a.k.a. dropdowns. The preferred way to set the value of one of these is using the ClickItem() method. However, some of our dropdowns contain over 1,000 items and it can take 30 seconds or more to set the value. Here is the function to set the value that I created (the wait loop is to try and handle slow JSON calls.): def SetJsonDropdownClick(fieldHandle, newName, newValue, waitForJson): if (waitForJson): stopTime = GetTickCount() + 20000; while (GetTickCount() < stopTime): if fieldHandle.wItemCount >= 2: fieldHandle.ClickItem(newName) if fieldHandle.value == newValue: break aqUtils.Delay(100) else: fieldHandle.ClickItem(newName) However, I found that assigning the value property can set the value property with sub-second response time. def SetJsonDropdownUd(fieldHandle, newValue, waitForJson, triggerJson): i = 0 if (waitForJson): stopTime = GetTickCount() + 20000; while (GetTickCount() < stopTime): if fieldHandle.wItemCount >= 2: fieldHandle.value = newValue if fieldHandle.value == newValue: break i += 1 Log.Message("Pass: " + str(i) + " Count: " + str(fieldHandle.wItemCount) + " Values [" + fieldHandle.value + "]/[" + newValue + "]") Log.Message(fieldHandle.innerHTML) aqUtils.Delay(100) Aliases.browser.Refresh() else: fieldHandle.value = newValue While this cuts the setting time to a consistent sub-second response, it does not raise the OnChange event that triggers JSON calls to fill other dropdowns on the page. I have confirmed by looking at similar issues on this site that this is normal behavior for setting a value that way. I even added the following to the end to get OnChange to fire. if (triggerJson): fieldHandle.Keys("[Up][Down]") While this reliably fires OnChange, it actually does it twice. And sometimes, the first one takes longer than the second (desired) one and the wrong data fills the next dropdown(s) and causes the test script to fail. The following may be marginally faster: def SetJsonDropdownItemList(fieldHandle, newName, newValue, waitForJson): if (waitForJson): stopTime = GetTickCount() + 20000; while (GetTickCount() < stopTime): i = -1 if fieldHandle.wItemCount >= 2: itemListWork = fieldHandle.wItemList.split(';') for i in range(len(itemListWork)): if (itemListWork[i] == newName): fieldHandle.ClickItem(i) break if (i >= 0 & i < len(itemListWork)): break else: aqUtils.Delay(100) else: itemListWork = fieldHandle.wItemList.split(';') for i in range(len(itemListWork)): if (itemListWork[i] == newName): fieldHandle.ClickItem(i) break It still takes time due to the manual search. Since nearly all our dropdowns are sorted alphanumerically, I can implement a binary search. But, still, this and the text based ClickItem take 50% longer than setting the value. I also spent a good amount of time looking at https://community.smartbear.com/t5/TestComplete-Desktop-Testing/ClickItem-Very-Slow-For-DropDown-ComboBox/m-p/136051#M8569 While we have the same symptom, our dropdown list items are children of the dropdown itself. And, the slow selection happens whether the dropdown is filled at page creation or set up later with a JSON call. So, I either need a way to speed up ClickItem() or to trigger the fields OnChange event when setting the value. And, I know that the RaiseEvent function does not handle HTML objects. We are using Python as the scripting language and the TC version is 14.30.Solved1.8KViews0likes5CommentsNeed to import a framework developed in Python 2.7 into TestComplete
We have 2 different test suites one for front end and one for backend testing needs. The front end suite was developed in VB on TestComplete while the backend test suite was developed on Python 2 outside TestComplete. We are looking to have a unified shared Python based development down the lane where we can share the libraries between UI and backend development. The problem here is that this python test suite was developed on Python 2 and is currently supported on Python 2.7 rather than the TestComplete supported Python 3.6. Any suggestions on how can I do that while still maintaning support for the ongoing Python 2 devlopment from other teams and our team developing further UI test/backend scenarios in Python on TestComplete.Solved1.6KViews0likes1CommentTestComplete lock library files after first run
Hi, I faced with problem when importing several librarys. On first test run everythins works as expected, but if I try to run agait the same routine without re-run testcomplete I get an error. The problem is that library files was locked by testcomplete process on first run, and they was not released after test is finished. Here my code: sys.path.insert(0, Project.Path + '..\\Lib') sys.path.insert(0, Project.Path + '..\\..\\') from APItests import LogGenerator import io nism_ip = ProjectSuite.Variables.NismIP falcon_ip = Project.Variables.MARipageURL.split('/')[2] f = io.StringIO() sys.stdout = f sys.stderr = f def clear_logs(): """ Clear all log events on falcon """ LogGenerator.clear_logs(falcon_ip, nism_ip) print_stdout() def print_stdout(): """ Function to print in Log.Message the 'print()' statement """ output = f.getvalue().split('\n') for o in output: Log.Message(o) f.seek(0) f.truncate(0) On first run of 'clear_logs()' routine it's passed, but on second run there has error: SystemError: initialization of _psycopg raised unreported exception 9:52:03 Normal 0.00 The script execution was interrupted. 9:52:03 Normal 0.18 TestComplete locks files for psycopg2 and for lxml librarys. As workaround I found only one solution - rerun testcomplete Anyone have sugestions how to fix these issue?1.4KViews0likes1Comment