Skip to content
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

clojure.test integration #613

Closed
bbatsov opened this issue Jun 10, 2014 · 8 comments
Closed

clojure.test integration #613

bbatsov opened this issue Jun 10, 2014 · 8 comments

Comments

@bbatsov
Copy link
Member

bbatsov commented Jun 10, 2014

clojure-test-mode is an unsupported mess full of inlined Clojure code. It's considered officially deprecated right now and it'd be nice if we bundled clojure.test support directly into cider as it's the standard test framework. I'm seeing two options:

  1. A single command cider-test-ns that simply opens the output of the test run into a new buffer
  2. Maintaining a feature set and UI similar to that of clojure-test-mode.

At any rate we'll need some basic middleware for running the tests and clearing their definitions before test re-runs. @jeffvalk Would you like to look into implementing this? Should be reasonable straight-forward. I'm tied up cleaning up clojure-mode and hunting encoding/decoding issues and won't be able to attend to this any time soon, but I want us to lay clojure-test-mode to rest once and for all.

@expez
Copy link
Member

expez commented Jun 10, 2014

Any hope of this making it into 0.7? I think a lot of people are eager to get on the 'stable branch' after essentially being forced to ride master for cider and cider-nrepl the last months. Staying on 0.7-STABLE until 0.8-STABLE comes out would leave those users without a reliable way to run their tests for quite some time (development time for 0.8 + delays due to summer vacations).

@jeffvalk
Copy link
Contributor

@bbatsov This had been in the back of my mind as well. I will try to carve out some time for this in the next week.

Without having looked into any implementation details yet, one design issue does come to mind: how to deal with test exceptions. With clojure-test-mode, any exceptions from tests simply had their stacktraces dumped to the REPL. As a result, I always found the signal-to-noise ratio frustratingly low whenever test errors occurred. Naturally, I'd like to see test exceptions presented using cider-stacktrace, but this implies displaying a single test's error causes (or multiple errant tests in sequence, which sounds like a mess). Our test runner will need a natural/comfortable way to manage this. One possibility that stands out to me is:

  • In middleware, capture each test's results, including exceptions, and store the most recent test results in the session.
  • In the client, present test results in a popup buffer, and allow the user to highlight an exception-throwing test.
  • On a user's command, query the middleware for the stacktrace of the highlighted test's exception and display it using cider-stacktrace.

@bbatsov Any thoughts on this? This strikes me as a design issue @hugoduncan might like to weigh in on too.

@bbatsov
Copy link
Member Author

bbatsov commented Jun 10, 2014

@jeffvalk Sounds like an excellent idea to me! The UI design I had in mind is pretty much what you describe - a listing of tests in a popup buffer, with the ability to act on failing tests and see some details about the failure.

@jeffvalk
Copy link
Contributor

Ok. I'll roll with that.

@hugoduncan
Copy link
Member

Having exceptions from clojure.test displayed with cider-stacktrace would be a huge improvement.

Having test fails in a separate buffer would also be useful, espescially if displayed using the test context information provided by testing forms. Being able to re-run a specific test from the list of failed tests would be interesting too.

Integrating test fail output with ediff is something I use a lot from clojure-test-mode, as is the ability to pretty-print failures.

Note that a test function can have multiple fails, but only one error (after which the rest of the test function is not run).

@hugoduncan
Copy link
Member

Another consideration, perhaps for a later date, would be to design the ops for the test middleware such that other test systems (such as midje) could provide an implementation.

@bbatsov
Copy link
Member Author

bbatsov commented Jun 10, 2014

Being able to re-run a specific test from the list of failed tests would be interesting too.

Nice idea. Perhaps we can have the option to rerun the test at point in the list or all failed tests together.

Integrating test fail output with ediff is something I use a lot from clojure-test-mode, as is the ability to pretty-print failures.

We should start small. This could be added at a later point in time.

Note that a test function can have multiple fails, but only one error (after which the rest of the test function is not run).

Indeed. We should have 3 states for the tests - passed, failed and erred (or something like that).

Another consideration, perhaps for a later date, would be to design the ops for the test middleware such that other test systems (such as midje) could provide an implementation.

That'd be great indeed, but we should definitely start small and avoid over-engineering the initial solution.

jeffvalk added a commit to jeffvalk/cider that referenced this issue Jun 16, 2014
jeffvalk added a commit to jeffvalk/cider that referenced this issue Jun 16, 2014
Add 'cider-test', to replace the retired 'clojure-test-mode'.

Add mostly complete cider-test result layout.

Enable cider-test mode and key bindings.

Add interactive run functions. Rename cider-test-report-mode.

Echo testing and summary messages.

Clean up emit/insert code.

Add test report result navigation; rename report buffer.

Clean up variable names and function arguments.

Handle test namespace not found.

Add ediff for test results. Clean up a bit.

Clean up code, add doc strings, improve menus.

Enable jump to line within var.

Move modified functions into their proper files.

Highlight non-passing test definitions.

Fix some code ordering, and add a funcall.

Update README and CHANGELOG for test integration.

Update doc strings and commentary.
jeffvalk added a commit to jeffvalk/cider that referenced this issue Jun 16, 2014
Add 'cider-test', to replace the retired 'clojure-test-mode'.

Add mostly complete cider-test result layout.

Enable cider-test mode and key bindings.

Add interactive run functions. Rename cider-test-report-mode.

Echo testing and summary messages.

Clean up emit/insert code.

Add test report result navigation; rename report buffer.

Clean up variable names and function arguments.

Handle test namespace not found.

Add ediff for test results. Clean up a bit.

Clean up code, add doc strings, improve menus.

Enable jump to line within var.

Move modified functions into their proper files.

Highlight non-passing test definitions.

Fix some code ordering, and add a funcall.

Update README and CHANGELOG for test integration.

Update doc strings and commentary.
@jeffvalk
Copy link
Contributor

What's in PR #625 should fit the bill.

bbatsov added a commit that referenced this issue Jun 16, 2014
[Fix #613] Add clojure.test integration.
dgtized pushed a commit to dgtized/cider that referenced this issue Jun 24, 2014
Add 'cider-test' to replace the venerable, now-retired 'clojure-test-mode'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants