简体   繁体   中英

WSO2 EI - Integration Studio Unit Test Configuration

I'm trying to build a simple test suite with one test case for an api artifact:

I created the following test suite:

<unit-test>
         <artifacts>
          <test-artifact>
            <artifact>/DevOps_Deploy/src/main/synapse-config/api/testEsbDevOps.xml</artifact>
        </test-artifact>
        <supportive-artifacts/>
        <registry-resources/>
        <connector-resources/>
    </artifacts>
    <test-cases>
        <test-case name="TestOutput">
            <input>
                <request-path>/Project</request-path>
                <request-method>GET</request-method>
            </input>
            <assertions>
                <assertNotNull>
                    <actual>$body</actual>
                    <message>error</message>
                </assertNotNull>
            </assertions>
        </test-case>
    </test-cases>
    <mock-services/>
</unit-test>

Then, to run the Unit Test i entered the ip and port of the server in which the EI is running. But i get the following error:

[INFO] U N I T - T E S T S

[INFO] ------------------------------------------------------------------------

[INFO] Detect 1 Synapse test case files to execute

[INFO] 

[error] Error in getting response from the synapse unit test agent

java.io.StreamCorruptedException: invalid stream header: 48545450
       at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:866)
       at java.io.ObjectInputStream.<init>(ObjectInputStream.java:358)
       at org.wso2.synapse.unittest.TCPClient.readData(TCPClient.java:69)
       at org.wso2.synapse.unittest.UnitTestClient.executeTests(UnitTestClient.java:60)
       at org.wso2.synapse.unittest.UnitTestCasesMojo.testCaseRunner(UnitTestCasesMojo.java:143)
       at org.wso2.synapse.unittest.UnitTestCasesMojo.execute(UnitTestCasesMojo.java:78)
       at ...
..
[INFO] No test cases found in D:\Users\user\IntegrationStudio\workspace\MavenParentProjectDevOps\DevOps_Deploy\test\TestSuiteOne.xml unit test suite

where did I go wrong?

Did you start the EI server with the -DsynspaseTest parameter as follows?

For windows:

integrator.bat -DsynapseTest

For Linux/MacOS

sh integrator.sh -DsynapseTest

Note - If you want to change the testing port from default 9008 to another, you could use -DsynapseTestPort=<available-port> additionally in above commands.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM