Use bpelunit to generate test cases?

16 views
Skip to first unread message

Zhou Hongwei

unread,
Oct 10, 2016, 11:19:03 PM10/10/16
to BPELUnit
Hello,
May I use bpelunit to generate test cases? I want to  get the test cases according to the bpel file.
Do not know whether can use wsdl4j to parse the bpel variable constraint conditions, and then use the z3 solver to solve constraints,then get the test case? If you have any ideas, also hope to provide help.

Thank you !
Hongwei Zhou

Daniel Lübke

unread,
Oct 11, 2016, 1:29:03 AM10/11/16
to BPELUnit
Dear Hongwei,

BPELUnit itself does not offer automatic generation of test cases. However, this is certainly an interesting project.

BPELUnit itself will "only" execute the BPTS file. So, your generation approach will need to parse the BPEL, WSDL and XSD files and generate a corresponding test suite file (BPTS). The problem is probably quite hard because you have a) the possible process executions and service interactions defined by the BPEL file (control-flow) and the possible SOAP payload as defined by the XSD. Both are dependent on each other (e.g. a certain SOAP Message will trigger a certain branch).

I would first look at ACMs digital library etc. to search for related work.

Regards,
Daniel

Zhou Hongwei

unread,
Oct 11, 2016, 1:53:27 AM10/11/16
to BPELUnit


在 2016年10月11日星期二 UTC+8下午1:29:03,Daniel Lübke写道:
Dear Daniel,

Thank you very much for your reply. In the project, using the most simple addition and subtraction service process as a test bpel file, I am trying to use wsdl4j to parse of bpel, don't know whether suitable or not. For the bpel file and the soap message, I also need to research, it is a complex project.

Finally, also want to ask, for "the Exception > org. Apache. The ode, axis2. OdeFault: SOAP body does not contain the required parts: content. & # 13;" Mistake, do you have a better solution? 

for the suite.bpts:
<?xml version="1.0" encoding="UTF-8"?>
    <tes:name>suite.bpts</tes:name>
    <tes:baseURL>http://localhost:7777/ws</tes:baseURL>
    <tes:deployment>
        <tes:put type="fixed" name="CaculatorProcess">
            <tes:wsdl>bpelContent/CaculatorProcessArtifacts.wsdl</tes:wsdl>
        </tes:put>
    </tes:deployment>
    <tes:testCases>
        <tes:testCase name="CaculatorTest" basedOn="client" abstract="false" vary="false">
            <tes:clientTrack>
                <tes:sendReceive service="sam:CaculatorProcessService" port="CaculatorProcessPort" operation="process">
                    <tes:send service="sam:CaculatorProcessService" port="CaculatorProcessPort" operation="process" fault="false">
                        <tes:data>dsaf</tes:data>
                    </tes:send>
                    <tes:receive service="sam:CaculatorProcessService" port="CaculatorProcessPort" operation="process" fault="false">
                        <tes:condition>
                            <tes:expression>//sam:a</tes:expression>
                            <tes:value>4</tes:value>
                        </tes:condition>
                        <tes:condition>
                            <tes:expression>//sam:b</tes:expression>
                            <tes:value>7</tes:value>
                        </tes:condition>
                        <tes:condition>
                            <tes:expression>//sam:type</tes:expression>
                            <tes:value>add</tes:value>
                        </tes:condition>
                    </tes:receive>
                </tes:sendReceive>
            </tes:clientTrack>
        </tes:testCase>
    </tes:testCases>
</tes:testSuite>

for the wsdl:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     TYPE DEFINITION - List of types participating in this BPEL process 
     The BPEL Designer will generate default request and response types
     but you can define or import any XML Schema type and use them as part 
     of the message types.
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->    
    <plnk:partnerLinkType name="addPLT">
    <plnk:role name="addProvider" portType="wsdl:AddService"/>
  </plnk:partnerLinkType>
    <plnk:partnerLinkType name="subPLT">
    <plnk:role name="subProvider" portType="wsdl1:SubService"/>
  </plnk:partnerLinkType>
    <import location="AddService.wsdl" namespace="http://add.example.ws"/>
    <import location="SubService.wsdl" namespace="http://sub.example.ws"/>
    <types>
        <schema xmlns="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://eclipse.org/bpel/sample">

            <element name="CaculatorProcessRequest">
                <complexType>
                    <sequence>
                    <element name="a" type="double" />
                    <element name="b" type="double"></element>
                    <element name="type" type="string"></element>
                    </sequence>
                </complexType>
            </element>

            <element name="CaculatorProcessResponse">
                <complexType>
                    <sequence>
                        <element name="result" type="double"/>
                    </sequence>
                </complexType>
            </element>
        </schema>
    </types>


<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     MESSAGE TYPE DEFINITION - Definition of the message types used as 
     part of the port type defintions
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->    
    <message name="CaculatorProcessRequestMessage">
        <part element="tns:CaculatorProcessRequest" name="payload"/>
    </message>
    <message name="CaculatorProcessResponseMessage">
        <part element="tns:CaculatorProcessResponse" name="payload"/>
    </message>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     PORT TYPE DEFINITION - A port type groups a set of operations into
     a logical service unit.
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->    

    <!-- portType implemented by the CaculatorProcess BPEL process -->
    <portType name="CaculatorProcess">
        <operation name="process">
            <input message="tns:CaculatorProcessRequestMessage"/>
            <output message="tns:CaculatorProcessResponseMessage"/>
        </operation>
    </portType>   
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     PARTNER LINK TYPE DEFINITION
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->    
    <plnk:partnerLinkType name="CaculatorProcess">
        <plnk:role name="CaculatorProcessProvider" portType="tns:CaculatorProcess"/>
    </plnk:partnerLinkType>
    

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     BINDING DEFINITION - Defines the message format and protocol details
     for a web service.
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <binding name="CaculatorProcessBinding" type="tns:CaculatorProcess">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="process">
    <soap:operation soapAction="http://eclipse.org/bpel/sample/process"/>
    <input>
    <soap:body use="literal"/>
    </input>
    <output>
    <soap:body use="literal"/>
    </output>
    </operation>
    </binding>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     SERVICE DEFINITION - A service groups a set of ports into
     a service unit.
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <service name="CaculatorProcessService">
    <port binding="tns:CaculatorProcessBinding" name="CaculatorProcessPort">
    </port>
    </service>
</definitions>


thank you again!
Hongwei Zhou

Antonio García Domínguez

unread,
Oct 11, 2016, 5:39:06 AM10/11/16
to bpel...@googlegroups.com
Dear Zhou,

We developed a tool called BPTSGenerator that does some of this. The binaries and source code are on our Nexus instance:


To use it, download the uberjar distribution and run it like this:

java -jar the.jar your.bpts

The project itself is here:


It doesn't cover every possible .bpel file, but it's worth a quick try :-). Feel free to have a stab at the source code if you find that it doesn't do something that you want.

Kind regards,
Antonio

--
Sie erhalten diese Nachricht, weil Sie in Google Groups E-Mails von der Gruppe "BPELUnit" abonniert haben.
Wenn Sie sich von dieser Gruppe abmelden und keine E-Mails mehr von dieser Gruppe erhalten möchten, senden Sie eine E-Mail an bpelunit+unsubscribe@googlegroups.com.
Weitere Optionen finden Sie unter https://groups.google.com/d/optout.

Zhou Hongwei

unread,
Oct 13, 2016, 3:10:52 AM10/13/16
to BPELUnit
Dear Antonio,

Thank you very much for your reply. In our project, it requires to convert the bpel file to state diagram or CFG figure, then traverse the CFG flow diagram, get the test sequence, and test cases. Do you know any tools or methods that can be converted into CFG flow diagram ?


I think the tool BPTSL - generator is very strong, but it's a pity that I don't have to deploy success, I want to know whether it can import the bpel file, then automatically parse the bpel file, get a series of .bpts files, and then let the bpelunit automatically perform?Thank you very much for your help.

Thank you!
Hongwei Zhou

在 2016年10月11日星期二 UTC+8下午5:39:06,Antonio García Domínguez写道:
Wenn Sie sich von dieser Gruppe abmelden und keine E-Mails mehr von dieser Gruppe erhalten möchten, senden Sie eine E-Mail an bpelunit+u...@googlegroups.com.

Antonio García Domínguez

unread,
Oct 13, 2016, 5:03:01 AM10/13/16
to bpel...@googlegroups.com
Dear Zhou,

I have heard about tools that produce CFGs from BPEL files before. During the development of BPTSGenerator (back in 2012, I think) we looked around and found some works based on CFGs and Symbolic Transition Systems. Perhaps it'd be worth looking into what these authors used or how they went on with their research:


I'm not sure if I understand what you mean with "deploy success", but yes, the idea of BPTSGenerator is that if you give it a .bpel file, it will produce a first version of a .bpts that you can use. The .bpts will use template-based tests - our goal was to use it in tandem with TestGenerator, our test generation tool. We can't guarantee that it'll work with any .bpts files - it did work with most of the .bpel files we had in our repository:


Kind regards,
Antonio


Wenn Sie sich von dieser Gruppe abmelden und keine E-Mails mehr von dieser Gruppe erhalten möchten, senden Sie eine E-Mail an bpelunit+unsubscribe@googlegroups.com.
Message has been deleted
Message has been deleted

Zhou Hongwei

unread,
Oct 14, 2016, 1:23:40 AM10/14/16
to BPELUnit

Dear Antonio,

Thank you very much for your reply and kind help. Now, I am very interested in the bpel-generator tool, and try to use it. When I use HelloBPELProcess bpel file, it's very lucky to get the . BPTS file, the following code:

<?xml version="1.0" encoding="UTF-8"?>
  <tes:name>HelloBPELProcessTest</tes:name>
  <tes:baseURL>http://localhost:7777/ws</tes:baseURL>
  <tes:deployment>
    <tes:put name="HelloBPELProcess" type="activebpel">
      <tes:wsdl>HelloBPELProcessArtifacts.wsdl</tes:wsdl>
      <tes:property name="BPRFile">HelloBPELProcess.bpr</tes:property>
    </tes:put>
  </tes:deployment>
  <tes:setUp>
    <tes:dataSource type="velocity" src="data.vm">
      <tes:property name="iteratedVars">HelloBPELProcessRequest</tes:property>
    </tes:dataSource>
  </tes:setUp>
  <tes:testCases>
    <tes:testCase name="MainTemplate" basedOn="" abstract="false" vary="false">
      <tes:clientTrack>
        <tes:sendReceive service="sam:HelloBPELProcessService" port="HelloBPELProcessPort" operation="process">
          <tes:send fault="false">
            <tes:template><![CDATA[<s:HelloBPELProcessRequest xmlns:s="http://sample.bpel.org/bpel/sample"><s:input>$HelloBPELProcessRequest</s:input></s:HelloBPELProcessRequest>]]></tes:template>
          </tes:send>
          <tes:receive fault="false"/>
        </tes:sendReceive>
      </tes:clientTrack>
    </tes:testCase>
  </tes:testCases>
</tes:testSuite>


I try to use bpelunit to test this .BPTS file , encountered an error, as shown in the figure below.




For the bpel-genertor, can generate specific test cases? as shown in the figure below. And where is the test case generated code?




Project under "https://neptuno.uca.es/redmine/projects/sources-fm/repository/show/trunk/src", In order to want to look around carafully, I wonder if you have any corresponding document of project?


Thank you very nuch!

Hongwei Zhou



在 2016年10月13日星期四 UTC+8下午5:03:01,Antonio García Domínguez写道:

Antonio García Domínguez

unread,
Oct 17, 2016, 7:02:08 AM10/17/16
to bpel...@googlegroups.com
Dear Zhou,

Good! I see that it was able to produce the .bpts and .vm file. It should have generated the data.vm file for you in the same folder, but if it hasn't, you can use our TestGenerator tool to do it [1]. From Linux or Mac, it can be used like this:

test-generator-1.1.0-SNAPSHOT/testgenerator data.spec > data.vm

Here is a description of the TestSpec format we use for the .spec files:


And here are some instructions for the other utilities for managing the .vm files we use for test data:


If you want to write specific test cases, you can try and simply define your own data entries in the .vm file. If the generated test template doesn't fit your intended test case, you'll have to write your own, sorry! This tool was mostly intended for automated data-driven test case generation.


Kind regards,
Antonio

Wenn Sie sich von dieser Gruppe abmelden und keine E-Mails mehr von dieser Gruppe erhalten möchten, senden Sie eine E-Mail an bpelunit+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages