Forum Discussion

barsand's avatar
barsand
New Contributor
12 years ago

writing back to soapUI using the API to modify names

Does anybody have an example on how to load a soapUI project into the memory using the XML DOM, then parse it and index all names and references to those names automatically?

For instance if I have:
TestSuite1
TestCase1
TestStep1 and TestStep2

THEN, I would like to rename them programmatically to:

1TestSuite1
1.1TestCase1
1.1.1TestStep1 and 1.1.2TestStep2

I was thinking to use something like this:
    public TestProject read(InputStream inputStream)
{
SoapuiProjectDocumentConfig documentConfig;
documentConfig = SoapuiProjectDocumentConfig.Factory.parse(inputStream);
ProjectConfig soapuiProject = documentConfig.getSoapuiProject();
// createTestProject loads the project and modifies it
TestProject testProject = createTestProject(soapuiProject);
return testProject;
}


and then

 public void write(TestProject testProject, OutputStream outputStream)
{
SoapuiProjectDocumentConfig documentConfig;
documentConfig = SoapuiProjectDocumentConfig.Factory.parse(outputStream);
ProjectConfig soapuiProject = documentConfig.setSoapuiProject(ProjectConfig soapuiProject);
}

Any input into this is welcome. One fear I have for this is the referential integrity not being preserved where objects (relying on the changing names) in the TestProject are not going to be automatically updated.
No RepliesBe the first to reply