java - Rest service running with JUnit -
i have created sample project given on soapui.org: http://www.soapui.org/rest-testing/getting-started.html . after creating it, have exported test case folder "soaprest.xml". want integrate service junit. tried following code:
import com.eviware.soapui.tools.soapuitestcaserunner; public class sample_restservice { @test public void soapuirest(){ soapuitestcaserunner runner = new soapuitestcaserunner(); runner.setprojectfile("c:\\users\\meharkoduri\\soaprest.xml"); try { runner.run(); } catch (exception e) { system.out.println(e); //e.printstacktrace(); } } }
i getting following error:
soapui 4.0.0 testcase runner 11:46:57,736 warn [soapui] missing folder [c:\users\meharkoduri\workspace\soaprest_project\.\ext] external libraries 11:46:57,738 info [defaultsoapuicore] creating new settings @ [c:\users\meharkoduri\soapui-settings.xml] org.apache.xmlbeans.xmlexception: element testcase@http://eviware.com/soapui/config not valid soapui-project@http://eviware.com/soapui/config document or valid substitution. @ org.apache.xmlbeans.impl.store.locale.autotypedocument(locale.java:328) @ org.apache.xmlbeans.impl.store.locale.parsetoxmlobject(locale.java:1279) @ org.apache.xmlbeans.impl.store.locale.parsetoxmlobject(locale.java:1263) @ org.apache.xmlbeans.impl.schema.schematypeloaderbase.parse(schematypeloaderbase.java:345) @ com.eviware.soapui.config.soapuiprojectdocumentconfig$factory.parse(unknown source) @ com.eviware.soapui.impl.wsdl.wsdlproject.loadproject(wsdlproject.java:314) @ com.eviware.soapui.impl.wsdl.wsdlproject.<init>(wsdlproject.java:234) @ com.eviware.soapui.impl.wsdl.wsdlprojectfactory.createnew(wsdlprojectfactory.java:41) @ com.eviware.soapui.impl.wsdl.wsdlprojectfactory.createnew(wsdlprojectfactory.java:24) @ com.eviware.soapui.tools.soapuitestcaserunner.runrunner(soapuitestcaserunner.java:319) @ com.eviware.soapui.tools.abstractsoapuirunner.run(abstractsoapuirunner.java:151) @ sample_restservice.soapuirest(sample_restservice.java:16) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.junit.runners.model.frameworkmethod$1.runreflectivecall(frameworkmethod.java:44) @ org.junit.internal.runners.model.reflectivecallable.run(reflectivecallable.java:15) @ org.junit.runners.model.frameworkmethod.invokeexplosively(frameworkmethod.java:41) @ org.junit.internal.runners.statements.invokemethod.evaluate(invokemethod.java:20) @ org.junit.runners.blockjunit4classrunner.runnotignored(blockjunit4classrunner.java:79) @ org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:71) @ org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:49) @ org.junit.runners.parentrunner$3.run(parentrunner.java:193) @ org.junit.runners.parentrunner$1.schedule(parentrunner.java:52) @ org.junit.runners.parentrunner.runchildren(parentrunner.java:191) @ org.junit.runners.parentrunner.access$000(parentrunner.java:42) @ org.junit.runners.parentrunner$2.evaluate(parentrunner.java:184) @ org.junit.runners.parentrunner.run(parentrunner.java:236) @ org.eclipse.jdt.internal.junit4.runner.junit4testreference.run(junit4testreference.java:50) @ org.eclipse.jdt.internal.junit.runner.testexecution.run(testexecution.java:38) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:467) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:683) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.run(remotetestrunner.java:390) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.main(remotetestrunner.java:197) 11:46:59,504 error [soapui] error occured [failed load project file [file:/c:/users/meharkoduri/soaprest_extestcase-1.xml]], see error log details com.eviware.soapui.support.soapuiexception: failed load project file [file:/c:/users/meharkoduri/soaprest_extestcase-1.xml] @ com.eviware.soapui.impl.wsdl.wsdlproject.loadproject(wsdlproject.java:404) @ com.eviware.soapui.impl.wsdl.wsdlproject.<init>(wsdlproject.java:234) @ com.eviware.soapui.impl.wsdl.wsdlprojectfactory.createnew(wsdlprojectfactory.java:41) @ com.eviware.soapui.impl.wsdl.wsdlprojectfactory.createnew(wsdlprojectfactory.java:24) @ com.eviware.soapui.tools.soapuitestcaserunner.runrunner(soapuitestcaserunner.java:319) @ com.eviware.soapui.tools.abstractsoapuirunner.run(abstractsoapuirunner.java:151) @ sample_restservice.soapuirest(sample_restservice.java:16) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.junit.runners.model.frameworkmethod$1.runreflectivecall(frameworkmethod.java:44) @ org.junit.internal.runners.model.reflectivecallable.run(reflectivecallable.java:15) @ org.junit.runners.model.frameworkmethod.invokeexplosively(frameworkmethod.java:41) @ org.junit.internal.runners.statements.invokemethod.evaluate(invokemethod.java:20) @ org.junit.runners.blockjunit4classrunner.runnotignored(blockjunit4classrunner.java:79) @ org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:71) @ org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:49) @ org.junit.runners.parentrunner$3.run(parentrunner.java:193) @ org.junit.runners.parentrunner$1.schedule(parentrunner.java:52) @ org.junit.runners.parentrunner.runchildren(parentrunner.java:191) @ org.junit.runners.parentrunner.access$000(parentrunner.java:42) @ org.junit.runners.parentrunner$2.evaluate(parentrunner.java:184) @ org.junit.runners.parentrunner.run(parentrunner.java:236) @ org.eclipse.jdt.internal.junit4.runner.junit4testreference.run(junit4testreference.java:50) @ org.eclipse.jdt.internal.junit.runner.testexecution.run(testexecution.java:38) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:467) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:683) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.run(remotetestrunner.java:390) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.main(remotetestrunner.java:197) caused by: org.apache.xmlbeans.xmlexception: element testcase@http://eviware.com/soapui/config not valid soapui-project@http://eviware.com/soapui/config document or valid substitution. @ org.apache.xmlbeans.impl.store.locale.autotypedocument(locale.java:328) @ org.apache.xmlbeans.impl.store.locale.parsetoxmlobject(locale.java:1279) @ org.apache.xmlbeans.impl.store.locale.parsetoxmlobject(locale.java:1263) @ org.apache.xmlbeans.impl.schema.schematypeloaderbase.parse(schematypeloaderbase.java:345) @ com.eviware.soapui.config.soapuiprojectdocumentconfig$factory.parse(unknown source) @ com.eviware.soapui.impl.wsdl.wsdlproject.loadproject(wsdlproject.java:314) ... 29 more java.lang.exception: failed load soapui project file [c:\users\meharkoduri\soaprest_extestcase-1.xml]
note: aim integrate junit.
Comments
Post a Comment