Variable declaration in a javascript class
Hi, Can we declare global variables within a javascipt class, outside a function? When I try to declare a variable, it gives error: Syntax Error: Unexpected identifier Sample code: class Test { var abc; //received above error var abc = "Test"; //received above error let def; //received above error function1() { //some code here var abcd = "New"; //works fine here } Please suggest how I can create variables outside the functions in this scenario. Thanks!Solved29KViews0likes2CommentsCaused by: groovy.lang.MissingPropertyException: No such property: testCase for class: Script2
I'm using below script to get the error message from test-step in listener level. I place this script under TestRunListener.afterRun def logPrefix = testCase.getName() + ': ' log.info (logPrefix + 'Number of results = ' + testRunner.getResults().size().toString()) for(result in testRunner.getResults()){ if(result.getStatus().toString() != 'PASS' ){ def failedTestStepName = result.getTestStep().getName() def logPrefixStep = logPrefix.trim() + failedTestStepName + ': ' log.error(logPrefixStep + 'TestStep "' + failedTestStepName + '" finished with the status ' + result.getStatus().toString()) for(testProperty in testCase.getTestStepByName(failedTestStepName).getPropertyList()){ if(testProperty.isReadOnly()){ log.info(logPrefixStep + 'Output property: ' + testProperty.getName() + ' = ' + testProperty.getValue()) }else{ log.info(logPrefixStep + 'Input property: ' + testProperty.getName() + ' = ' + testProperty.getValue()) } } for(message in result.getMessages()){ log.error(logPrefixStep + 'Error message: ' + message) } } } whenever running my test cases. I'm getting below error Thu Nov 21 15:32:05 UTC 2019: ERROR: com.eviware.soapui.support.scripting.ScriptException: Error in TestRunListener.afterRun com.eviware.soapui.support.scripting.ScriptException: Error in TestRunListener.afterRun at com.eviware.soapui.eventhandlers.support.DefaultSoapUIEventHandler.invoke(DefaultSoapUIEventHandler.java:31) at com.eviware.soapui.eventhandlers.support.AbstractEventHandlerMetaData.invokeHandlers(AbstractEventHandlerMetaData.java:80) at com.eviware.soapui.eventhandlers.support.AbstractEventHandlerMetaData.invokeHandlers(AbstractEventHandlerMetaData.java:61) at com.eviware.soapui.eventhandlers.impl.EventHandlersTestRunListener.afterRun(EventHandlersTestRunListener.java:36) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.notifyAfterRun(AbstractTestCaseRunner.java:360) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalFinally(AbstractTestCaseRunner.java:212) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalFinally(AbstractTestCaseRunner.java:1) at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:154) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: groovy.lang.MissingPropertyException: No such property: testCase for class: Script2 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:66) at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:51) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:310) at Script2.run(Script2.groovy:4) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:94) at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SoapUIProGroovyScriptEngineFactory.java:83) at com.eviware.soapui.eventhandlers.support.DefaultSoapUIScript.invoke(DefaultSoapUIScript.java:42) at com.eviware.soapui.eventhandlers.support.DefaultSoapUIEventHandler.invoke(DefaultSoapUIEventHandler.java:29) ... 12 more I'm using readyAPI 3.0.Solved27KViews0likes2CommentsCan I put multiple project in one Git repository?
Dear Community, I'm setting up Gitlab repository to allow multiple tester to work together on scripts for the different modules we develop. I initially thought to create one repository named "API-Script" and put all the ReadyAPI project in it (one ReadyAPI project per module we develop). Is somebody could tell me if it's possible? And if it's not a good practice, why? Thanks,Solved24KViews0likes7Comments[SoapUI 5.2.1] mockRequest is NULL in REST MockService
I'm using SoapUI 5.2.1 and I have a REST MockService. Whenever I try to implement the following script, I get the NullPointerException . Script: def requestBody = mockRequest.getRequestContent() log.info "Request body: " + requestBody Error: com.eviware.soapui.impl.wsdl.mock.DispatchException: Failed to dispatch using script; java.lang.NullPointerException: Cannot invoke method getRequestContent() on null object This is a very frustating error that I'm continuously getting, and surprisingly there is no helpful solution anywhere. Please Help!!!! PS : I'm trying to get the content of a HTTP GET request.Solved22KViews0likes14CommentsHow to import a javascript class and extend it in another script unit
Hi I am trying to use two Javascript projects - and export a class defined in one to be extended (inherited) in another. The example herehttps://community.smartbear.com/t5/TestComplete-General-Discussions/how-to-import-a-javascript-class/m-p/149161#M27448 shows how to use require and create an instance of the class. However, I would like to inherit the class (ES6) and define or override the methods. I was able to do this using prototype based inheritance (ES3). But unable to do this using ES6 terms. The "import" keyword usage shows syntax error "Unexpected token import". If I use require, then I cannot actually use it with extends e.g. (Note that I have shared the Parent.js into the project) //In Parent.js class ParentApp { constructor(x) { this.name = x; } } module.exports = { ParentApp: ParentApp } //In Child.js var parent = require("Parent") class Child extends parent.ParentApp { constructor(y, z) { super(y); this.age = z; } } Here the "parent.Parent" is not working. And I can't use import keyword. (Note that sometimes having the script name same as class name seems to cause issues and that's why I use Parent and ParentApp to differentiate) So how do I do this? Is ES6 fully suppported in Test Complete 14?Solved16KViews0likes6Commentsgetting BUG! exception in phase 'semantic analysis' in source unit 'Script1.groovy'
Hi All. I'm working on the script library in readyAPI 2.8.0 I have a readyAPI project saved in C/soapui and I've created a folder calledGroovyLibrary inside the project folder (C/soapui/GroovyLibrary). I place my below script inside the groovyLibrary folder. package soapui .GroovyLibrary class Callee { String hello() { return "Hello world!" } def static salute( who, log ) { log.info "Hello again $who!" }} I followed the exact the way it mentioned in the below documentation https://support.smartbear.com/readyapi/docs/testing/scripts/library.html#_ga=2.210636115.718279044.1573586134-774997694.1532459669 but while executing the groovy from readyAPI; I'm getting below execption BUG! exception in phase 'semantic analysis' in source unit 'Script2.groovy' The lookup for Callee caused a failed compilaton. There should not have been any compilation from this call. How can I rectify this? anyhelp would be appreciated. Thanks.Solved15KViews0likes9CommentsSSL Security error when running SQL scripts
Hey all. Wemade some security updates switching from TLS 1.1 to TLS 1.2 on our SQL servers and we get the following error when attempting to connect to the server "[DBNETLIB][ConnectionOpen (SECCreateCredentials()).]SSL Security error" for the script in particular we use a connection string like follows "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DBNAME;Data Source=SERVERNAME;" NOTE:I also changed it to use ODBC instead and still for the SSL Security Error Prior to the security update, everything has been hunky dory and we have not had errors with anything else. has anyone else experienced this issue or know the best way to resolve?Solved15KViews0likes4Commentsgetting groovy error when trying to run groovy script - EvictableCache
Any ideas how to fix this? ERROR: java.lang.NoSuchMethodError: org.codehaus.groovy.runtime.memoize.EvictableCache.getAndPut(Ljava/lang/Object;Lorg/codehaus/groovy/runtime/memoize/MemoizeCache$ValueProvider;)Ljava/lang/Object;Solved13KViews0likes11Comments[TechCorner Challenge #8] Finding Elements on a Web Page
Hi TestComplete Community! Today, I bring you a new TechCorner Challenge task π By completing the tasks, you will not only learn TestComplete features but also get into the TechCorner Leaderboard. Today we will use the Leaderboard table itself to sharpen your skills! Letβs use TestComplete to find out if a user is on the table and how many points they gained so far! Task: Create a TestComplete script that will go to theLeaderboard page, search for yourself (by your user name) and a user named tristaanogre in the table and, if this user is mentioned on the Leaderboard, post their score to the log. Can you compete with people in the Leaderboard?π Difficulty: Tip: You can useFindChildorFindElementin your script. Note: You will need a Web Module to fulfill this task. Good luck!Solved13KViews2likes7Comments