Error using custom JAR in SOAP UI Groovy Test Step
I am trying to include custom code for SAML generation (in form of JAR) into Groovy test step. Below are the steps I followed : 1. Created JAR 2.Copied JAR and their dependencies in .../bin/ext 3. Restarted SOAP UI Added below code in Groovy test step: import com.example.test.SAML2OpenSamlHelper; SAML2OpenSamlHelper s = new SAML2OpenSamlHelper(); String saml = s.generateResponseString("Raj","mypage.com", null, false, "", false, false); log.info (saml); But getting below error when executing : Thu Jun 30 14:10:25 MST 2016:ERROR:java.lang.NoClassDefFoundError: org/apache/velocity/app/Velocity java.lang.NoClassDefFoundError: org/apache/velocity/app/Velocity at org.opensaml.DefaultBootstrap.initializeVelocity(DefaultBootstrap.java:172) at org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:89) at com.example.test.SAML2OpenSamlHelper.setUp(SAML2OpenSamlHelper.java:212) at com.example.test.SAML2OpenSamlHelper.init(SAML2OpenSamlHelper.java:190) at com.example.test.SAML2OpenSamlHelper.(SAML2OpenSamlHelper.java:124) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186) at Script6.run(Script6.groovy:2) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:92) at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:141) at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:250) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Am I doing something wrong or missing some step ? Help will be appreciated... Thanks, AbhiSolved2.3KViews0likes3CommentsHow to save log.info/error/warning from groovy test step
Hi, I have big groovy script usable in both SoapUI Free and SoapUI pro. i have there lots of Log Outgoing how to save them by groovy script? all logs i found and try some kudos have result like this: /***********************enum test*************/ import com.eviware.soapui.model.testsuite.Assertable.AssertionStatus // firsthly def ArrayList - enums // this enums is available for change if another enums will change, dont change another part of code List<String> country = new ArrayList<String> (["MK", "AD", "AE", "AF"]) //, "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "CH", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW"]) log.info "!!!!!!!Dont stop this Test Step!!!!!!!!!" log.info "!!!!!!!Dont change this Test Step when run!!!!!!!!!" log.info "!!!!!!!Wait for results at least 10 minutes!!!!!!!!!" //def actual test Case and Test STep def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ); def testCase = testRunner.testCase; def testStep = testCase.getTestStepAt(context.currentStepIndex + 2); //set property country with value item into TestCase testRunner.testCase.setPropertyValue("country", country[0]) //log.info testStep + ": " + country[0] //now run test step (will be run by count of enum values) testRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testCase, null); testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep); testStep.run(testRunner, testStepContext); // here we detect if test case were failed (when is not firsth if, then list all assertion test steps in test case, is usable as Tear Down Script too) def StepList = testCase.getTestStepList() if (country != country[0] && country[0] != null){ StepList.each{ if(it.metaClass.hasProperty(it,'assertionStatus')){ if(it.assertionStatus != AssertionStatus.FAILED){ log.error "${it.name} FAIL with value of: " + item return; } else if(it.assertionStatus == AssertionStatus.VALID){ log.info "${it.name} OK!" // now loop arrayList value by value it means item and run it in Test step MTD-ESB-TLM-Country-all (next 1th test step) for (String item : country) { //set property country with value item into TestCase testRunner.testCase.setPropertyValue("country", item) //log.info testStep + ": " + item //now run test step (will be run by count of enum values) testRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testCase, null); testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep); testStep.run(testRunner, testStepContext); } } else if(it.assertionStatus == AssertionStatus.UNKNOWN){ log.info "${it.name} UNKNOWN (PROBABLY NOT ALREADY EXECUTED)" log.error "${it.name} FAIL with value of: " + item return; } } } } }/***********************enum test*************/ import com.eviware.soapui.model.testsuite.Assertable.AssertionStatus // firsthly def ArrayList - enums // this enums is available for change if another enums will change, dont change another part of code List<String> country = new ArrayList<String> (["MK", "AD", "AE", "AF"]) //, "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "CH", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW"]) log.info "!!!!!!!Dont stop this Test Step!!!!!!!!!" log.info "!!!!!!!Dont change this Test Step when run!!!!!!!!!" log.info "!!!!!!!Wait for results at least 10 minutes!!!!!!!!!" //def actual test Case and Test STep def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ); def testCase = testRunner.testCase; def testStep = testCase.getTestStepAt(context.currentStepIndex + 2); //set property country with value item into TestCase testRunner.testCase.setPropertyValue("country", country[0]) //log.info testStep + ": " + country[0] //now run test step (will be run by count of enum values) testRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testCase, null); testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep); testStep.run(testRunner, testStepContext); // here we detect if test case were failed (when is not firsth if, then list all assertion test steps in test case, is usable as Tear Down Script too) def StepList = testCase.getTestStepList() if (country != country[0] && country[0] != null){ StepList.each{ if(it.metaClass.hasProperty(it,'assertionStatus')){ if(it.assertionStatus != AssertionStatus.FAILED){ log.error "${it.name} FAIL with value of: " + item return; } else if(it.assertionStatus == AssertionStatus.VALID){ log.info "${it.name} OK!" // now loop arrayList value by value it means item and run it in Test step MTD-ESB-TLM-Country-all (next 1th test step) for (String item : country) { //set property country with value item into TestCase testRunner.testCase.setPropertyValue("country", item) //log.info testStep + ": " + item //now run test step (will be run by count of enum values) testRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testCase, null); testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep); testStep.run(testRunner, testStepContext); } } else if(it.assertionStatus == AssertionStatus.UNKNOWN){ log.info "${it.name} UNKNOWN (PROBABLY NOT ALREADY EXECUTED)" log.error "${it.name} FAIL with value of: " + item return; } } } } } It means: it log only part of code, but not log.info/error/warning... from Log Output with the values of variables - I may made it manualy, but I want execute all project from command line its general task from our DevOps. How to script it in both versions (not all testers here have full version) Thanks for answer1.2KViews0likes3Comments