From: "Tom Clarke" <tom@u2i.com>
To: git@vger.kernel.org
Subject: How to re-use setups in multiple tests?
Date: Mon, 1 Oct 2007 12:27:49 +0200 [thread overview]
Message-ID: <550f9510710010327l3e729ff1tbbb9b6c674c1cb11@mail.gmail.com> (raw)
I'm wondering if there's a pattern for re-using setups across several
tests, similar to how a setUp function is used in xUnit. The problem
is I need the setup to actually be re-run, for each test to start from
a clean slate, so using the following doesn't work as the setup is
just run before the first test.
test_expect_success setup '
# setup repostory to a particular state
'
test_expect_success test1 '
# some test that expects the state to be as defined in setup, and
changes state of repository
'
test_expect_success test2 '
# another test that expects the state to be as defined in setup
'
Is there a convention for doing this that's already used? Perhaps
pulling the setup code into a function or duplicating the code? Or is
it better to create a separate test file for tests that need to be
isolated?
Thanks,
-Tom
next reply other threads:[~2007-10-01 10:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-01 10:27 Tom Clarke [this message]
2007-10-01 11:45 ` How to re-use setups in multiple tests? Johannes Schindelin
2007-10-01 12:16 ` Tom Clarke
2007-10-01 12:39 ` Johannes Schindelin
2007-10-01 12:46 ` Tom Clarke
2007-10-01 13:40 ` Karl Hasselström
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=550f9510710010327l3e729ff1tbbb9b6c674c1cb11@mail.gmail.com \
--to=tom@u2i.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).