test suite design with erlang

Kent Boortz kent@REDACTED
Mon Aug 7 18:11:20 CEST 2000


Are you talking about generating the test cases, i.e. the code
or input to the testing or are you talking about investigating
the test result from a test run?

In other words, what is the "ptl-summary"? A specification for a test
run or the result from one?

Maybe your question is to someone that know rational rose, I don't
know what "bt(basic test tool)" or "PROCESS in bt-toolbox" is all
about.

If the parsing is a problem is to be done off-line and a lot more
complicated than in the small example you sent, why not use Perl for
parsing (if you know Perl) and let it output the summary in a more
easy to read format for Erlang. The summary lines you gave above can
be parsed and tranform to the text representation of a term with

  print "[\n";
  while (<DATA>) {
      chomp;
      # You got to looove Perl ;-)
      print "  [",join(",",map {"\"$_\""} split(/\s*COL\d+:/)),"]";
      print eof(DATA) ? "\n" : ",\n";
  }
  print "].\n";
  
  __DATA__
  ConnectionNoParam COL2:off_hook( ) COL3:Phone1 COL4:Port1 COL5:0
  ConnectionNoParam COL2:dial_tone( ) COL3:Port1 COL4:Phone1 COL5:1

and the output can be read with 

  1> file:consult("r.term").
  {ok,[[["ConnectionNoParam","off_hook( )","Phone1","Port1","0"],
        ["ConnectionNoParam","dial_tone( )","Port1","Phone1","1"]]]}

This will of cause not work if the summary files are huge and you can't
have it all in memory.

A solution in Erlang could be to read line by line, something like the
attached file below. Problem is that parsing code like this often gets
messy. A better solution might be to use the regexp:split() function
and split each line on " COL[0-9]+:".

kent

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ttt.erl
Type: application/octet-stream
Size: 1894 bytes
Desc: Ad hoc parsing example
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20000807/a1d7a5f1/attachment.obj>


More information about the erlang-questions mailing list