14 years ago
ClassCastException when Using runFromCommandLine Method
Hi,
I am using the SoapUI Pro API and I am having trouble using the runFromCommandLine method. I am trying to automate tests using the API.
Below is what I have done:
1. Created a WsdlProjectPro object from an empty soapUI Pro project created in soapUI Pro.
WsdlProjectPro project = new WsdlProjectPro("Path/to/SomeEmpty-soapui-project");
2. Imported WSDLs into the project;
for(Wsdl w: listOfWsdls){
project.importWsdl(w);
}
3. Imported TestSuites
for(File f: testSuiteProFiles){
project.importTestSuite(f);
}
4. Set some properties.
5. Saved the file.
project.saveAs("new-soapui-project.xml");
6. Create a new Runner object and execute the runFromCommandLine method.
SoapUIProTestCaseRunner runner1 = new SoapUIProTestCaseRunner();
runner1.runFromCommandLine(commandLineArgs);
I get the following stack trace from the console:
18:46:16,782 INFO [WsdlProject] Saved project [Test] to [C:\Users\automation\TestNew-soapui-project.xml - 27490294 bytes
soapUI Pro 4.5.0 TestCase Runner
18:46:16,807 INFO [CoverageBuilder] constructor
18:46:17,031 INFO [WsdlProject] Loaded project from [file:/C:/Users/automation/TestNew-soapui-project.xml]
18:46:17,103 ERROR [SoapUIProTestCaseRunner] java.lang.ClassCastException: com.eviware.soapui.impl.wsdl.WsdlProject cannot be cast to com.eviware.soapui.impl.wsdl.WsdlProjectPro
18:46:17,103 ERROR [SoapUI] An error occured [com.eviware.soapui.impl.wsdl.WsdlProject cannot be cast to com.eviware.soapui.impl.wsdl.WsdlProjectPro], see error log for details
java.lang.ClassCastException: com.eviware.soapui.impl.wsdl.WsdlProject cannot be cast to com.eviware.soapui.impl.wsdl.WsdlProjectPro
at com.eviware.soapui.SoapUIProTestCaseRunner.initProjectProperties(SourceFile:303)
at com.eviware.soapui.tools.SoapUITestCaseRunner.initProject(SoapUITestCaseRunner.java:485)
at com.eviware.soapui.SoapUIProTestCaseRunner.initProject(SourceFile:161)
at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:343)
at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:158)
at com.eviware.soapui.tools.AbstractSoapUIRunner.runFromCommandLine(AbstractSoapUIRunner.java:89)
at automation.Main.main(Main.java:42)
The only objects that I use are Pro objects (WsdlProjectPro, WsdlTestSuitePro, etc.) but I still get the error. When I open the project in soapUI and Launch the TestRunner everything is fine.
I invoke the runFromCommandLine method with the new file I saved as the project parameter and I guess the object being created by default is a WsdlProject. I can pass a WsdlProjectPro
object to initProject and runProject to get past the error but I don't get the results that I need. Is there any way around this? Any help would be appreciated.
Thank You
I am using the SoapUI Pro API and I am having trouble using the runFromCommandLine method. I am trying to automate tests using the API.
Below is what I have done:
1. Created a WsdlProjectPro object from an empty soapUI Pro project created in soapUI Pro.
WsdlProjectPro project = new WsdlProjectPro("Path/to/SomeEmpty-soapui-project");
2. Imported WSDLs into the project;
for(Wsdl w: listOfWsdls){
project.importWsdl(w);
}
3. Imported TestSuites
for(File f: testSuiteProFiles){
project.importTestSuite(f);
}
4. Set some properties.
5. Saved the file.
project.saveAs("new-soapui-project.xml");
6. Create a new Runner object and execute the runFromCommandLine method.
SoapUIProTestCaseRunner runner1 = new SoapUIProTestCaseRunner();
runner1.runFromCommandLine(commandLineArgs);
I get the following stack trace from the console:
18:46:16,782 INFO [WsdlProject] Saved project [Test] to [C:\Users\automation\TestNew-soapui-project.xml - 27490294 bytes
soapUI Pro 4.5.0 TestCase Runner
18:46:16,807 INFO [CoverageBuilder] constructor
18:46:17,031 INFO [WsdlProject] Loaded project from [file:/C:/Users/automation/TestNew-soapui-project.xml]
18:46:17,103 ERROR [SoapUIProTestCaseRunner] java.lang.ClassCastException: com.eviware.soapui.impl.wsdl.WsdlProject cannot be cast to com.eviware.soapui.impl.wsdl.WsdlProjectPro
18:46:17,103 ERROR [SoapUI] An error occured [com.eviware.soapui.impl.wsdl.WsdlProject cannot be cast to com.eviware.soapui.impl.wsdl.WsdlProjectPro], see error log for details
java.lang.ClassCastException: com.eviware.soapui.impl.wsdl.WsdlProject cannot be cast to com.eviware.soapui.impl.wsdl.WsdlProjectPro
at com.eviware.soapui.SoapUIProTestCaseRunner.initProjectProperties(SourceFile:303)
at com.eviware.soapui.tools.SoapUITestCaseRunner.initProject(SoapUITestCaseRunner.java:485)
at com.eviware.soapui.SoapUIProTestCaseRunner.initProject(SourceFile:161)
at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:343)
at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:158)
at com.eviware.soapui.tools.AbstractSoapUIRunner.runFromCommandLine(AbstractSoapUIRunner.java:89)
at automation.Main.main(Main.java:42)
The only objects that I use are Pro objects (WsdlProjectPro, WsdlTestSuitePro, etc.) but I still get the error. When I open the project in soapUI and Launch the TestRunner everything is fine.
I invoke the runFromCommandLine method with the new file I saved as the project parameter and I guess the object being created by default is a WsdlProject. I can pass a WsdlProjectPro
object to initProject and runProject to get past the error but I don't get the results that I need. Is there any way around this? Any help would be appreciated.
Thank You