citrusframework / citrusframework/citrus-remote

Citrus 2.7.2 test cases can run inside citrus remote container but citrus remote server always get empty test results

Open
#25 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
0
Forks
4
PR merge metrics
No merged PRs in 30d

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) @ ---
[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: /test//target/citrus-remote/citrus-test-results.html
[INFO] Generated test report: /test//target/citrus-remote/citrus-summary.xml
[INFO] Writing report file: /test//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//target/-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//citrus//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

```


org.citrusframework
citrus-remote-maven-plugin
${citrus-remote-maven-plugin}


trigger-citrus-remote

test

${citrus.remote.test.phase}


http://localhost:4567


junit4
true
999999000



^.*DummyTest$



file.encoding
UTF-8


citrus.file.encoding
UTF-8




${citrus.remote.report.directory}


```

### 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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with CitrusRemoteApplication and the RemoteTestListener registration through CitrusInstanceManager. Reproduce the issue with the provided DummyTest and compare its JUnit4 execution with the citrus-remote-sample, especially the result callbacks and report requests. Done means remote JUnit4 runs populate the returned test results and generated reports instead of showing zero tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.