简体   繁体   English

WSO2 EI - Integration Studio 单元测试配置

[英]WSO2 EI - Integration Studio Unit Test Configuration

I'm trying to build a simple test suite with one test case for an api artifact:我正在尝试构建一个简单的测试套件,其中包含一个用于 api 工件的测试用例:

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.然后,为了运行单元测试,我输入了运行 EI 的服务器的 IP 和端口。 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?您是否使用-DsynspaseTest参数启动了 EI 服务器,如下所示?

For windows:对于窗户:

integrator.bat -DsynapseTest

For Linux/MacOS对于 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.注意 -如果您想将测试端口从默认 9008 更改为另一个,您可以在上述命令中额外使用-DsynapseTestPort=<available-port>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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