simple_tests server

Gaspar Chilingarov nm@REDACTED
Tue Aug 9 01:15:23 CEST 2005


Hi all ;)


Finnaly I ended up with very simplified version of test_server,
which is almost equal in syntax with original test_server, but are much more
lightweight and easy to use.


I've put simple test module into attach
--
-module(adder).

-compile(export_all).

add(3,Y) -> 2*3 + Y;
add(X,Y) -> X + Y.
--

test suite looks almost the same as for test_server
--
-module(adder_SUITE).
                                                                                             -include("test_server.hrl").

-export([all/1, test1/1, test2/1]).

all(doc) -> "example test from adder module";
all(suite) -> [ test1, test2 ].


test1(doc) -> "Test simple adding";
test1(Config) when is_list(Config) ->
        ?line 7 = adder:add(2,5),
        ?line 9 = adder:add(7,2).


test2(doc) -> "Test special case";
test2(Config) when is_list(Config) ->
        ?line 7 = adder:add(4, 3),
        ?line 7 = adder:add(3, 4),
        ok.
--
first test should pass and second one is failing.

if you run this command in unix shell
erl -s simple_tests run adder_SUITE -s init stop | grep '^\(FAIL\|PASS\):'

with output like this
PASS: "Test simple adding"
FAIL: "Test special case" (at {adder_SUITE,21}) reason {{badmatch,10},

it will grep passed and failed tests in adder module - which is almost enougth
for developing simple standalone applications.

Now, which functions should would you recommend to port test_server here?
Which functions are useful and commonly used in testing and which ones are
rare?

Thanks in advance :)

-- 
Gaspar Chilingarov
System Administrator

t +37491 419763
w www.web.am
e nm@REDACTED
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simple_tests.tbz
Type: application/octet-stream
Size: 1562 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20050809/8218d050/attachment.obj>


More information about the erlang-questions mailing list