简体   繁体   English

(clojure测试)配置leiningen在src中运行测试(不仅在测试目录中)

[英](clojure testing) Configure leiningen to run tests inside src (not only in the test directory)

When writing tests I like to use both tests defined with deftest and placed inside the test directory, and tests defined with with-test and placed next to the function definition in the src directory. 在编写测试时,我喜欢使用deftest定义的测试并放在测试目录中,并使用with-test定义with-test并放在src目录中的函数定义旁边。

I use deftest for tests that require complicated setup and would be quite messy to define next to the function under test. 我对需要复杂设置的测试使用deftest ,并且在测试中的函数旁边定义会非常混乱。

I use with-test for testing functions with simple input parameters. 我使用with-test来测试具有简单输入参数的函数。

I am able to run the tests defined in the source by running the (run-tests) macro. 我可以通过运行(run-tests)宏来运行源中定义(run-tests)

I run the deftest tests with lein test . 我运行deftest与测试lein test

Is there a way to configure lein test to also pick up all the tests in the src directory (the with-test tests)? 有没有办法配置lein test以获取src目录中的所有测试( with-test测试)?

您是否尝试将src添加到项目定义中的:test-paths列表中?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM