-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Excluding and/or including certain tests via metadata #126
Comments
While it is probably useful to make Polylith's built-in test runner somewhat flexible, if I was the maintainer of Poly, I wouldn't put too much focus on that. There are several test runners available to Clojure already and we can only expect more to be developed. Those projects are focused on making the test runner experience the best possible - integration with test types, reporting, coverage etc. There's a great blog post from Lambdaisland discussing this topic. I think Polylith's main focus should be the management of all the various projects in the workspace, and it should try and integrate with and delegate tasks to existing tooling outside of its main area of responsibility. Test runners are a good case in my opinion. Both Kaocha and Cognitect's own have good configurability so if One more reason for this is that teams might already have their preferred test runner solution (with static config/plugins to integrate with their ci etc. processes), be it one of the above mentioned or some other tool (internal tool even). If |
@imrekoszo The main problem is that every test runner out there is different so integrating @pithyless I think perhaps profiles would be something to look at for putting benchmarking, performance, and integration tests into a separate component and bringing them into the context when you want to run them. I agree it's not as flexible as using metadata and keywords -- and that would be a nice enhancement for |
@seancorfield I didn't mean the poly team should do all of this, I think it would be enough to make it pluggable some way. One possibility would be a command that returns all the context info (classpath etc) about projects whose tests need to be executed so teams can use that to call their test runners. |
Currently, Polylith finds all the test namespaces that were affected by the latest changes and uses cognitect-labs/test-runner to run those tests. The tests are run in the correct context, e.g. in the context of a specific project. The dependencies are resolved via It could be unnecessary for developers to repeat all those in order to use another test runner. An idea could be that Polylith prepares everything to run the tests, and the user of Polylith could provide a Clojure function that is used to run the tests. This way, any other test runner library could be utilized. Also, we could make the default test runner utilize this functionality and hence make the Cognitect's test runner dependency more transparent. At the moment, it is hidden in the codebase and injected on runtime. |
@furkan3ayraktar I like that idea |
@furkan3ayraktar It doesn't use Cognitect's Since folks are also asking about Cloverage, I think maybe figuring out a way to provide alternate functions to call instead of Part of the problem here is that most test runners -- and Cloverage -- subsume the entire role of Some useful things that |
@seancorfield one very useful thing that (binding [test/*test-out* (io/writer (io/file output "junit.xml"))]
(junit/with-junit-output (apply test/run-tests nses))) but currently the way |
@furkan3ayraktar I think there would be value in finding all affected namespaces, not only test ones and passing them over to the test runner. There could be tests hidden in any of those (like kaocha's auto-generated s/fdef checks) and the test runner should be responsible for discovering them. The built-in test runner could further filter that namespace list to test namespaces only and run clojure.test-s in them. |
Related to #196 |
Given that we now have pluggable test runners for Polylith and we have both an in-process Kaocha runner and an external (out-of-process, isolated) "regular" test runner -- in addition to the default, built-in one -- this issue has, I think, gotten more complex to solve in a generic way but much easier to solve in a specific way: in other words, I think this issue should be closed and if the OP wants this feature for a specific runner, open a new issue against that? I'd be open to providing some way to filter tests in my external test runner project (but it would need to be via env vars, JVM properties, or a config file -- to avoid any complexity of trying to pass arguments through |
This is now supported by the External test runner test runner. |
Is your feature request related to a problem? Please describe.
I would like to write tests that should not always be run, eg:
Describe the solution you'd like
The
cognitect.test-runner
supports this via keyword options:The filter is applied to which vars will be run: https://github.com/cognitect-labs/test-runner/blob/334f2e2a5491747dff52f9ca8cbb4a53f54d344d/src/cognitect/test_runner.clj#L27-L32
I think a solution could be to similarly support filtering out specific metadata keywords before generating the final
test-statements
(after all the other logic for which bricks have changed, etc):polylith/components/test-runner/src/polylith/clj/core/test_runner/core.clj
Line 109 in 4b08954
The other question would be where to configure the inclusion/exclusions. Perhaps a combo of having defaults configured in the
workspace.edn
and support for passing specific exclusion/inclusion keywords viapoly test
?Describe alternatives you've considered
Right now, these kind of tests:
I would prefer if they would be first-class
deftest
vars that are tagged via metadata and a way of excluding/including the tags via thepoly test
CLI. Bonus points if we can havepoly
CLI report that X number of tests were skipped.Additional context
Kaocha test-runner also has a similar feature via:
Kaocha supports both filtering via metadata on the test-var and on the namespace. I would not consider the latter strictly necessary, but it is interesting to consider.
The text was updated successfully, but these errors were encountered: