-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Hi Dear,
I have legacy test cases of:
- citrus 2.7.2,
- test cases are of junit 4.13
- spring-core: 4.3.2.RELEASE
- spring-context: 4.3.2.RELEASE
- running in jre1.8
Now I tried to run those test cases in a container by citrus-remote maven plugin. Test cases can be found and run successfully.
But the testing result returned to citrus-remote maven plugin of test is always 0 test cases:
INFO] --- citrus-remote:4.6.0:test (trigger-citrus-remote) @ <my_submodule name> ---
[INFO]
INFO |
INFO | CITRUS TEST RESULTS
INFO |
INFO |
INFO | TOTAL: 0
INFO | PASSED: 0 (0.0%)
INFO | FAILED: 0 (0.0%)
INFO | TIME: 0 ms
INFO |
INFO | ------------------------------------------------------------------------
[INFO] Generated test report: <my_project_dir>/test/<my_submodule>/target/citrus-remote/citrus-test-results.html
[INFO] Generated test report: <my_project_dir>/test/<my_submodule>/target/citrus-remote/citrus-summary.xml
[INFO] Writing report file: <my_project_dir>/test/<my_submodule>/target/citrus-remote/TEST-TestSuite.xml
The result is the same whether I run test cases in my docker container, or run by 'java -jar citrus-tests.jar --duration 9223372036854775807 ' directly in my host.
The environment of running citrus-remote test jar in my container
- citrus-remote maven plugin: 4.5.2, or latest 4.6.0, the same.
- jdk17 (should not cause trouble, since all the test cases can finish successfully)
- Other dependencies of legacy citrus 2.7.x test cases are the same.
Reproduce
A simplest test case is tried and reproduce the issue:
import com.consol.citrus.annotations.CitrusTest;
import com.consol.citrus.dsl.junit.JUnit4CitrusTest;
import org.junit.Test;
public class DummyTest extends JUnit4CitrusTest {
@Test
@CitrusTest
public void kenTest() {
System.out.println("DummyTest#kenTest");
}
}
By running via jar directly (the same result if running inside docker container)
=============================
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 --add-opens java.base/java.lang=ALL-UNNAMED -jar test/<my_module>/target/<my_module>-50.0-feature-dummy-citus.0-SNAPSHOT-citrus-tests.jar --duration 9223372036854775807 --skipTests true
=============================
Listening for transport dt_socket at address: 5005
00:03:12,641 INFO rusRemoteApplication| Server started on port 4567
00:03:21,976 INFO rusRemoteApplication| PUT /run
00:03:22,071 INFO rusRemoteApplication| GET /results?timeout=999999000
00:03:22,234 INFO main.CitrusApp| Running Citrus 4.6.0
00:03:22,444 INFO n.JarFileTestScanner| Found test class candidate in test jar file: com/<my_company>/citrus/<sub_dir>/DummyTest.class
00:03:22,447 INFO nit.JUnit4TestEngine| Found 1 test classes to execute
00:03:22,452 INFO nit.JUnit4TestEngine| Running test com.my_company.citrus.inquiry.paymentstatus.mf.DummyTest
DummyTest#kenTest
00:03:22,556 INFO rusRemoteApplication| GET /results/files
00:03:22,571 INFO rusRemoteApplication| GET /results/suite
Analysis
As I debug the citrus-remote server side, I found results in RemoteTestListener is never updated, including by onTestSuccess. So results is always empty.
And I saw in CitrusRemoteApplication, the remoteTestListener is added as:
CitrusInstanceManager
.addInstanceProcessor(citrus -> citrus.addTestListener(remoteTestListener));
To trigger citrus testing run by citrus remote maven plugin
<plugins>
<plugin>
<groupId>org.citrusframework</groupId>
<artifactId>citrus-remote-maven-plugin</artifactId>
<version>${citrus-remote-maven-plugin}</version>
<executions>
<execution>
<id>trigger-citrus-remote</id>
<goals>
<goal>test</goal>
</goals>
<phase>${citrus.remote.test.phase}</phase>
<configuration>
<server>
<url>http://localhost:4567</url>
</server>
<run>
<engine>junit4</engine>
<async>true</async>
<pollingInterval>999999000</pollingInterval>
<classes>
</classes>
<includes>
<include>^.*DummyTest$</include>
</includes>
<systemProperties>
<property>
<name>file.encoding</name>
<value>UTF-8</value>
</property>
<property>
<name>citrus.file.encoding</name>
<value>UTF-8</value>
</property>
</systemProperties>
</run>
<report>
<directory>${citrus.remote.report.directory}</directory>
</report>
</configuration>
</execution>
Citrus-remote-sample
I tried Citrus-remote-sample, which works fine and can show 3 successful test cases in results. All good.
One thing is the demo GetTextIT is TestNG, not junit4.
I tried citrus 2.7.2, 2.7.9, got same issue.
Is there any way that onTestSuccess can be triggered so that results can be updated?
Any configurations of citrus 2.7.x, or of citrus remote plugin can help? Thanks