I supported and implemented this idea with the following assumptions (or lack of knowledge of):
- At that time, the classpath was flat for all the tests, both in the SE TCK variant or the Jakarta CTS variant, which made it simple to just wrap the SE tests and run them in a Jakarta EE container using Arquillian. Arquillian was just used as a deployer and executor of the test suite - the whole JUnit 5 test suite was deployed and executed in a Jakarta EE container
- I assumed that if different deployments are needed for some tests, then additional work is needed
- I didn't realize that the Jakarta TCK runs tests under different contexts (vehicles), I only focused on running the tests in a container using any (undefined) context. By default, Arquillian uses the Servlet context to deploy and also run the tests
With the latest changes (support injection of the JobOperator), the point 1 changes and we need change the classpath for some tests. This also impacts the point 2 - the deployment is no longer the same for all tests.
Your solution, Scott, is not a bad solution to address this quickly. My intention was to build a TCK framework to support this nicely and more flexibly, using some TCK API and annotations, that could be picked up by any execution mechanism, not just Arquillian. I hope I will be able to develop this later but I have no time to do it for Jakarta EE 10.
For point 3 (various execution contexts/vehicles), I don't know a full solution yet. I'm trying to figure out what's the best way to support this using either the plain JUNit5 approach or JUnit5 + Arquillian approach. I've studied the Jakarta EE TCK deeper today and it seems that it's doing a lot behind the scenes. Arquillian doesn't provide all of it. Arquillian only provides a deployment and execution mechanism for tests. Arquillian executes the whole test suite inside the tested container, so it's not easy to control what happens outside of the container, everything is controlled by Arquillian (e.g. how tests are triggered).
The Jakarta EE TCK controls everything, it only delegates some things to the porting package, like deployment. Execution of tests with Jakarta EE TCK is fully controlled by the TCK:
- The TCK creates the deployment package (using an Ant task)
- calls the porting package to deploy the deployable
- The TCK then triggers the tests using each required vehicle. E.g. for the servlet vehicle, it will trigger the test using an HTTP request to a servlet, for the EJB vehicle it will invoke a remote EJB to execute the test
The step 3 is what Arquillian can do too but it only uses one predefined mechanism. Arquillian can't execute a test method multiple times using different mechanisms. On the other hand, JUnit5 extension can execute a test multiple times, but I haven't found a way to instruct Arquillian to use a different mechanism for each execution. We might need to extend the Arquillian JUnit5 extension to modify it and pass some context from JUnit5. I know, I know, extending an extension sounds too complicated even to me :)
Ondro