Hi,
I tried your code, but unfortunately it did not help. I'll explain what happened below:
I create a factory like you explained and used the createNewTestStep-method with my testcase and "DataSource" as parameters.
The result should have been a TestStepConfig which I used for the code "testCase.addTestStep(testStepConfig)".
I tried this and got an error because the config was null. I debugged the code and I saw that the "object.getFactory("datasource")" would return a ProPlaceholderStepFactory, like I said before.
I once saw a code from this class (I think it was from version 4.6.1) where this method was not implemented and would always return null. This would make sense somehow, because this class is from the opensource library.
What kind of factory does your code return? Maybe I included the wrong libraries/ wrong versions for my project and therefore the WsdlTestStepRegistry does not support me with the correct factory.
At the moment I tried to work with the soapui-pro-maven-plugin:
<dependency>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-pro-maven-plugin</artifactId>
<version>5.1.1</version>
</dependency>
from your repository:
<repositories>
<repository>
<id>SmartBearRepository</id>
<url>
http://www.soapui.org/repository/maven2/</url> </repository>
</repositories>
The libraries I received from that are the soapui-5.1.1.jar, the soapui-pro-5.1.1.jar as well as their dependencies.
Do I use the correct sources or is there another way to get the libaries I need? For as far as I understood, I need both libraries. The pro and the opensource one, right?
----------------------------------------------------------------------------------------This is a different approach I have used to solve the problem:I use the following Maven configuration:
<dependency>
<groupId>com.github.redfish4ktc.soapui</groupId>
<artifactId>maven-soapui-extension-plugin</artifactId>
<version>4.6.4.1</version>
</dependency>
<dependency>
<groupId>com.fifesoft</groupId>
<artifactId>rsyntaxtextarea</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>com.jgoodies</groupId>
<artifactId>looks</artifactId>
<version>2.2.2</version>
</dependency>
This configuration allows me to create and manage soapui projects and save them as xml file via JAVA.
The following test steps I can already create:
-Delay
-Groovy
-JDBCStep
-Manual
-Properties
-PropertyTransfer
-RunTestCase
-SoapRequest
But I do not get how to create a DataSource test step correctly.
Currently it works with the following code to generate the DataSource Steps,
but i dont get it, how I can add optional parameters.
Or, how do I set the datasource to: JDBC, Excel or File?
First I have created a project (projectA.xml) via JAVA.
Then I have a created a testsuite (testsuiteA) and a testcase (testcaseA) via JAVA.
Now I want to create in the "testcaseA" a new DataSourceStep via JAVA!
This is my java method which can create DataSourceTestStep with a few paramaters but not with all:
String projectName = "projectA";
String testSuiteName = "testsuiteA";
String testCaseName ="testcaseA";
String testStepName ="stepA";
String description = "something here";
try {
projectName = utils.getProjectDirectory(projectName);
File projectFile = new File(projectName);
WsdlProjectPro project = new WsdlProjectPro(projectName);
WsdlTestSuitePro testSuite = (WsdlTestSuitePro) project.getTestSuiteByName(testSuiteName);
WsdlTestCasePro testCase = (WsdlTestCasePro) testSuite.getTestCaseByName(testCaseName);
// WsdlTestStep testStep = testCase.addTestStep(DataSourceStepFactory.DATASOURCE_TYPE, testStepName);
// WsdlDataSourceTestStep testStep =
(WsdlDataSourceTestStep) testCase.addTestStep(DataSourceStepFactory.DATASOURCE_TYPE,testStepName);
// testStep.setDataSource(ExcelDataSource.TYPE);
// testStep.setDescription(description);
TestStepConfig testStepConfig = TestStepConfig.Factory.newInstance();
testStepConfig.setType(DataSourceStepFactory.DATASOURCE_TYPE);
testStepConfig.setName(testStepName);
testStepConfig.setDescription(description);
WsdlProPlaceholderTestStep myTestStep = (WsdlProPlaceholderTestStep) testCase.addTestStep(testStepConfig);
//ExcelDataSource excelDS = new ExcelDataSource();
// WsdlDataSourceTestStep testStep = new WsdlDataSourceTestStep( testCase,testStepConfig , true);
// testStep.setDescription(description);// testStep.setDataSource(ExcelDataSource.TYPE);
// WsdlTestStep myTestStep = testCase.addTestStep(testStepConfig);
project.saveIn(projectFile);
} catch (Exception ex) {ex.printStackTrace();}
How can I set all the other parameters with values?
For instance something like that:
WsdlDataSourceTestStep configs = new WsdlDataSourceTestStep();
configs.setDisabled(true);
configs.setFailOnEmpty(false);
configs.setExpandProperties(true);
...
Many thanks in advance
