[erlang-questions] Erlang Testing frameworks, sorry.

Dave Smith dizzyd@REDACTED
Tue Feb 26 15:49:50 CET 2008


Berlin,

I recently went through this same decision process and finally decided
to learn how to use Common Test. It's a part of the OTP distro, so you
don't have to worry about maintaining a separate version of the
testing framework somewhere and it's pretty easy to use once you get
it setup. It has some really nice reporting tools and is clearly a
very mature framework...it's just the install stuff that I have issues
with. :)

My "setup" involved investigating the run_test.in script found in
erlang/lib/common_test-<vsn>/priv. Once I figured out what that was
doing, I wrote a macro (included below) for GNU make that makes it
easy for me to add unit tests to an apps Makefile:

# --------------------------------------------------------------------
#
# Macro for running unit tests using common_test fx
#
# --------------------------------------------------------------------
define run-tests
@mkdir -p test/logs
@erl -pa $(PWD)/ebin $(PWD)/include \
        -noshell -s ct_run script_start -s erlang halt \
        -dir . -logdir test/logs \
        -env TEST_DIR $(PWD)/test $*
endef

With that macro included in my make file, I can run tests by creating
a directory named "test" and dropping test suites in that directory
with the appropriate names (foo_SUITE.erl, as the case may be). I
invoke the macro in my app's Makefile like so:

test:
     $(run-tests)

I know that this isn't the how the instructions in the common_test
system recommends doing things. However, from my perspective requiring
developers to copy the entire common_test and test_server apps to
another directory just so a .in file can be processed is a little
redundant. I'm sure there are downsides with my approach, but from a
development standpoint it works and is easy to work with.

Hope that helps...

D.

On Tue, Feb 26, 2008 at 12:33 AM, Ulf Wiger (TN/EAB)
<ulf.wiger@REDACTED> wrote:
> Berlin Brown skrev:
>
> >
>  > So far, I want to use test server; it is unique but seems very stable
>  > and robust.
>  > http://www.erlang.org/project/test_server/index.html
>
>  As of OTP R12B, Common Test is a supported part of OTP.
>
>  http://www.erlang.org/doc/apps/common_test/index.html
>
>  It is used for test automation for some very important
>  products within Ericsson.
>
>
>  BR,
>  Ulf W
>
>
> _______________________________________________
>  erlang-questions mailing list
>  erlang-questions@REDACTED
>  http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list