TestComplete 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.4KViews0likes1CommentCommand Line Update Script Library and Reload
Hello I'm looking for some help or guidance on anissue.My issue has to do with loading the external script library in Ready! API. I want to be able to update the location of the external script library to a location that is relative to the project file (e.g. "$PROJECT_PATH/scripts"), and then be able to make calls on classes in the script library. This also must be possible from a clean install of Ready! API and load of the project file, so I cannot just set it once and then forget it. So, I've written the following code which accomplishes this task. This code is executed on the project "Load Script" and subsequent calls in the same script on the Script Library work correctly. //Update "Script Library" setting def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context) def projectPath = groovyUtils.projectPath def isCommandLine = com.eviware.soapui.SoapUI.isCommandLine log.info "Load Script" com.eviware.soapui.SoapUI.getSettings().setString("Script Library", "${projectPath}/scripts") com.eviware.soapui.SoapUI.saveSettings() However, this only work when running from GUI. When running from Command Line OR GUI, I get errors that it cannot find classes present in my external Script Library: "groovy.lang.MissingPropertyException: No such property: mypackgefor class: Script1" "org.codehaus.groovy.control.MultpleCompilationErrorsException: startup failed: Script1.groovy: 1: unable to resolve class mypackage.myclass ..." For continuous integration testing, I need this to work when invoking "testrunner.bat"/"testrunner.sh" and running tests. I've tried adding the following snippets of code, which do not seem to work either: //Update Groovy Script cache def engine = new com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory(isCommandLine) def classLoader = engine.getCoreClassLoader() def groovyClassLoader = new com.eviware.soapui.support.scripting.groovy.SoapUIGroovyClassLoader(classLoader, isCommandLine) groovyClassLoader.syncExternalClasses(true) and def core = com.eviware.soapui.SoapUI.getSoapUICore() core.reloadExternalLibraries() In the logs, I get messages that it did indeed set the Script Library path correctly and it is resetting the groovy class cache: INFO [SoapUIProGroovyScriptEngineFactory] Setting Script Library to [C:\path\to\script\library] INFO [SoapUIProGroovyScriptEngineFactory] Resetting groovy class cache due to 78 modified files Any advice on how to get this working from command line as well? EDIT: After further testing, my solution doesn't work even when using the GUI. EDIT2: Playing around some more and I found that in the GUI, if I move my Script Library calls out of the Project Load Script (where it's updating the Script Library path), it works just fine. However, command line execution still has trouble figuring out the Script Library calls (throws exceptions and such).1.5KViews0likes0Comments