[erlang-questions] Problem With Common Test
Tue Nov 17 10:30:49 CET 2009
As far as installation goes, the documentation really needs an update!
Before OTP R12, Common Test and Test Server weren't released as OTP
applications (and e.g. didn't have version numbers), and then you would
typically install these two apps separately from Erlang/OTP and generate
the run_test script (unix/linux) in the same place. You can still do
this, *but* what you would rather do these days is go to the common_test
directory under Erlang/OTP lib and run "./install.sh local" there. Then
you'd copy run_test from the CT priv/bin directory to where you want it
(the directory names expanded in the script are absolute), or update
$PATH with the CT priv/bin directory, or maybe create an alias or a link
to the script.
Note however that the installation procedure described in the User's
Guide is only necessary if you want/need the run_test script!! As with
any app that comes with OTP, you don't need an explicit install if
you're going to use it from the Erlang shell, or from an Erlang program.
Really, the installation chapter in the User's Guide needs to be
rewritten. I'll get to it promptly! Thanks for pointing the problem out!
About compiling test suites... Common Test has an auto compile feature
(chapter 6.2), i.e. it will compile your suite modules for you before
running the test. However, if you do want to compile the suite modules
yourself, you need to add the common_test and test_server include
directories to the compiler include path. Also, then, you should disable
the CT auto compile feature with the 'no_auto_compile' flag/option when
you run your test.
About the vts mode... One major drawback of this mode *is* that it uses
the current working directory as log directory. We've been wanting to
replace the existing, and very limited, vts mode with a much more useful
GUI mode. For that reason we haven't put effort into building all the
newer CT features into this mode. That said, if you follow the
instructions in chapter 6.4 to solve the "can't start netscape" problem
(which is actually a problem with the Webtools app rather than CT), and
you do have write permissions on the current working directory, vts
really *should* work. Try to first get a browser started and if the
configuration installation problem remains, get back to me, ok!?
About code coverage... It's not a requirement for the code coverage
analysis to work, that beam and source code modules are located in the
same directory! It's only if you want to generate html result files you
have this restriction. We will remove this restriction soon by making it
possible for CT to take a source code path as input (probably by means
of the cover spec file). It should be possible to locate the source code
for both apps that follow the OTP directory convention, and for apps
Ericsson AB, Erlang/OTP
Jayson Vantuyl wrote:
> I'm trying to get common_test working. I have a few problems.
> First, the install procedure is byzantine. I'm not asking for an immediate fix, but really, there has to be a better way.
> Next, if I use the example (which includes ct.hrl), I get the following trying to do an erl -make.
> Recompile: src/isopod_SUITE
> /opt/local/lib/erlang/lib/common_test-1.4.1/include/ct.hrl:20: can't find include file "test_server.hrl"
> So, it appears that it should be using include_lib, instead of include. If I write the test without the include, it works, but I can't use the ?line macros.
> Third, when I try to load the Visual Test Server, I get this:
> > Erlang R13B (erts-5.7.1) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
> > Starting webtool...
> > Eshell V5.7.1 (abort with ^G)
> > (ct@REDACTED)1> WebTool is available at http://localhost:8888/
> > Or http://127.0.0.1:8888/
> > Starting vts...
> > Sending URL to netscape...sh: line 0: exec: netscape: not found
> > not running, starting netscape...
> > Common Test starting (cwd is /Users/kagato/engineyard/swarm)
> > CT failed to install configuration data. Please verify that the log directory exists and that write permission is set.
> > User switch command
> > --> q
> Ignoring the "netscape" error, the "CT failed to install configuration data" is a problem. It appears to be contently using the current directory (and even creates a variables file), but it always gives this error. Specifying config files hasn't helped.
> Fourth, when will I be able to usably get coverage data? The requirement that the .beam files be in the same directory as the .erl files is pretty much a nonstarter. The feature might as well not exist, since it's completely incompatible with any of the packaging tools.
More information about the erlang-questions