Using java code analysis tool over the xwiki while performing functional testing

Hello everyone. I want to test Xrebel tool on Xwiki platform while I am running functional test. But xrebel gives me the output when it is added as a jvm argument to the xwiki. Then it will be available on a route of the server(for instance xwiki.local/xrebel), but when I run xwiki with functional testing command, I don’t have access to the web server that xwiki runs while performing integrated tests. How can I fix this problem?

Hi,

are you talking about the docker tests here? What command are you running specifically and in which module? Note that for docker tests the web server runs in a dedicated container so it might explain why you don’t have access to it.

There are lots of configuration options for our docker-based tests, see the documentation. Running an integration test leaves the XWiki test instance behind, at least with the default jetty_standalone mode. You could then manually start this instance (it is similar to a demo instance with bundled Jetty and the start/stop scripts) and tell the test framework to use this instance. This is described in this section about using an existing XWiki instance. That way, you have full control over the JVM arguments, and you can also easily access the XWiki instance before, during and after the tests.

1 Like

Hello. Indeed our Docker-based functional test framework doesn’t currently allow configuring the JVM arguments used to start the Servlet Engine. You have 2 options FTM:

  1. Do as Michael suggested,
  2. Modify https://github.com/xwiki/xwiki-platform/blob/f94888a856a1bad787d069067ea4645d0b236b82/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-docker/src/main/java/org/xwiki/test/docker/internal/junit5/servletengine/ServletContainerExecutor.java#L238 (example location for tomcat) and add your jvm argument that you need for XRebel. Build that maven module and re-run the test (with tomcat in this example, you can change for other servlet engines - Note that to change for jetty standalone, you’ll need to modify the jetty resources in some other module).
1 Like