2

I'm currently starting to build a package the TDD way, and for that I'm using ert, following ert-runner opinions.

I would like to write a set of pending tests, to identify what I have I to test, before to implement the test.

Is it possible to write pending test in ert?

If so how? :)

2

Placing a call to ert-skip at the beginning of your test would be the solution I believe. If you'd like, you can pass the string "pending" to the function to better show why it was skipped.

(ert-deftest my-pending-test ()
  (ert-skip "pending")
  (should (dostuff)))
  • Hey @Jordon, this is working indeed, however when I run it with ert-runner the test is identified as Passing. (which is finally the same compared with no body, as I way doing until now). Do you know if there is a way the test is identified as neither failed neither passing? :) – AdrieanKhisbe May 15 '15 at 9:32
  • maybe it's a bug in ert-runner? – npostavs May 15 '15 at 18:55
4

It's not specifically for "pending", but marking the test as expected to fail seems like it would be what you want: http://www.gnu.org/software/emacs/manual/html_node/ert/Expected-Failures.html

add `:expected-result :failed' to the test definition:

 (ert-deftest future-bug ()
   "Test `time-forward' with negative arguments.
 Since this functionality isn't implemented, the test is known to fail."
   :expected-result :failed
   (time-forward -1))

ERT will still display a small `f' in the progress bar as a reminder that there is a known bug, and will count the test as failed, but it will be quiet about it otherwise.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.