* ERT conventions?
@ 2015-09-06 5:01 Marcin Borkowski
2015-09-06 5:27 ` Alexis
0 siblings, 1 reply; 4+ messages in thread
From: Marcin Borkowski @ 2015-09-06 5:01 UTC (permalink / raw)
To: Help Gnu Emacs mailing list
Hi all,
I'm learning the ERT package. I'd like to know whether there are any
conventions/good practices regarding writing tests. Eg., should they be
written in a file separate from the package? (I guess yes, for obvious
reasons.) Are there any standards for the name of that file? In
general: could anyone using ERT (or any other testing facility, for that
matter) share some experiences worth knowing?
TIA,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ERT conventions?
2015-09-06 5:01 ERT conventions? Marcin Borkowski
@ 2015-09-06 5:27 ` Alexis
2015-09-06 6:10 ` Marcin Borkowski
0 siblings, 1 reply; 4+ messages in thread
From: Alexis @ 2015-09-06 5:27 UTC (permalink / raw)
To: help-gnu-emacs
Marcin Borkowski <mbork@mbork.pl> writes:
> Hi all,
>
> I'm learning the ERT package. I'd like to know whether there
> are any conventions/good practices regarding writing tests.
> Eg., should they be written in a file separate from the package?
> (I guess yes, for obvious reasons.) Are there any standards for
> the name of that file? In general: could anyone using ERT (or
> any other testing facility, for that matter) share some
> experiences worth knowing?
i've found ERT pretty easy to use. For `org-vcard`, i've put the
test suite in a single file within a distinct 'tests' folder,
which also contains a 'data' folder containing various data
sources for the tests to run on:
https://github.com/flexibeast/org-vcard/tree/master/tests
Alexis.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ERT conventions?
2015-09-06 5:27 ` Alexis
@ 2015-09-06 6:10 ` Marcin Borkowski
2015-09-06 6:43 ` Alexis
0 siblings, 1 reply; 4+ messages in thread
From: Marcin Borkowski @ 2015-09-06 6:10 UTC (permalink / raw)
To: help-gnu-emacs
On 2015-09-06, at 07:27, Alexis <flexibeast@gmail.com> wrote:
> Marcin Borkowski <mbork@mbork.pl> writes:
>
>> Hi all,
>>
>> I'm learning the ERT package. I'd like to know whether there
>> are any conventions/good practices regarding writing tests.
>> Eg., should they be written in a file separate from the package?
>> (I guess yes, for obvious reasons.) Are there any standards for
>> the name of that file? In general: could anyone using ERT (or
>> any other testing facility, for that matter) share some
>> experiences worth knowing?
>
> i've found ERT pretty easy to use. For `org-vcard`, i've put the
> test suite in a single file within a distinct 'tests' folder,
> which also contains a 'data' folder containing various data
> sources for the tests to run on:
Thanks!
And it's not that ERT is difficult to use, no. What I'm asking is (for
instance): is it better to say
(ert-deftest my-function-test ()
"Tests the `my-function' function."
(with-temp-buffer
(insert "input")
(goto-char (point-min))
(should (this-be-satisfied)
(should (that-be-satisfied)))))
or maybe
(ert-deftest my-function-test ()
"Tests the `my-function' function."
(should (with-temp-buffer
(insert "input")
(goto-char (point-min))
(this-be-satisfied)))
(should (with-temp-buffer
(insert "input")
(goto-char (point-min))
(that-be-satisfied))))
?
The former avoids code repetition and probably is (a bit) faster; the
latter /might/ result in better reporting.
Etc.
> Alexis.
Best,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ERT conventions?
2015-09-06 6:10 ` Marcin Borkowski
@ 2015-09-06 6:43 ` Alexis
0 siblings, 0 replies; 4+ messages in thread
From: Alexis @ 2015-09-06 6:43 UTC (permalink / raw)
To: help-gnu-emacs
Marcin Borkowski <mbork@mbork.pl> writes:
> The former avoids code repetition and probably is (a bit)
> faster; the latter /might/ result in better reporting.
Well, based on my experiences, it seems to me that neither would
produce better reporting than the other. i feel the `org-vcard`
tests aren't granular enough: multiple `should`s in the same
function can make (and has made) it more difficult to determine
exactly which `should` assertion is failing. So at some point,
resources permitting, i'd like to refactor the tests to
one-assertion-per-`ert-deftest`.
(Volunteers welcome! :-) )
Alexis.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-09-06 6:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-06 5:01 ERT conventions? Marcin Borkowski
2015-09-06 5:27 ` Alexis
2015-09-06 6:10 ` Marcin Borkowski
2015-09-06 6:43 ` Alexis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).