seancorfield / polylith-external-test-runner

An external (subprocess) test runner for Polylith
Apache License 2.0
13 stars 0 forks source link

poly tool FileNotFoundException #8

Open TimoKramer opened 2 days ago

TimoKramer commented 2 days ago

Hi, I am using your test runner for our polylith repo. Unfortunately running the test-runner with the poly binary in version 0.2.21 fails with FileNotFoundException. Is this expected?

$ poly test
Projects to run tests from: usermanager

Could not create valid test runner for the usermanager project: java.io.FileNotFoundException: Could not locate org/corfield/external_test_runner/interface__init.class, org/corfield/external_test_runner/interface.clj or org/corfield/external_test_runner/interface.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
Could not locate org/corfield/external_test_runner/interface__init.class, org/corfield/external_test_runner/interface.clj or org/corfield/external_test_runner/interface.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.

Here I've added your test-runner to your usermanager example.

Thank you

seancorfield commented 2 days ago

External test runners need to be on the classpath for Polylith to be able to see them. The poly command uses its own fixed classpath (which has just the Polylith CLI JAR) - it doesn't use your project dependencies.

I never use the poly tool itself but I suspect it's a shell script that wraps a java invocation? I don't if you could modify that to include a classpath with the external test runner source directory but that seems a bit fragile...

I use clojure -M:poly test -- using the project-specific :poly alias.

But this is a good reminder to me to add a note to the docs saying you much use the :poly alias, not the poly tool.

TimoKramer commented 2 days ago

Makes sense. I have another problem with poly invoking via clj unfortunately which I really can't figure out. But here's not the place to discuss that. Thanks and yes it makes sense to add a small note.