test suite design in Erlang

borge.fagerli@REDACTED borge.fagerli@REDACTED
Tue Aug 8 12:22:15 CEST 2000


Ok, I'm gonna clarify below...
> -----Original Message-----
> From:	Kent Boortz [SMTP:kent@REDACTED]
> Sent:	Monday, August 07, 2000 6:11 PM
> To:	borge.fagerli@REDACTED
> Cc:	erlang-questions@REDACTED
> Subject:	Re: test suite design with erlang
> 
> 
> 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?
> 
	The basis is a Message Sequence Chart in UML consisting of 4 units:
Phone 1, Port 1, Port 2 and Phone 2.
	The ptl file is a textual representation of the different units and
processes, as well as graphics interface in the given system. The
ptl-summary file extracts the needed data for generating an mp-file for
TTCN.
	The files:
	Excerpt from the ptl-summary file generated by the java program,
with the testcases ConnectionNoParam and BusyConnection:

ConnectionNoParam COL2:off_hook( ) COL3:Phone1 COL4:Port1 COL5:0
ConnectionNoParam COL2:dial_tone( ) COL3:Port1 COL4:Phone1 COL5:1
ConnectionNoParam COL2:dial_no(Byte) COL3:Phone1 COL4:Port1 COL5:2
ConnectionNoParam COL2:dial_no(Byte) COL3:Phone1 COL4:Port1 COL5:3
ConnectionNoParam COL2:dial_no(Byte) COL3:Phone1 COL4:Port1 COL5:4
ConnectionNoParam COL2:connection(String) COL3:Port1 COL4:Phone1 COL5:9
ConnectionNoParam COL2:start_ringing( ) COL3:Port1 COL4:Port2 COL5:5
ConnectionNoParam COL2:ringing_tone( ) COL3:Port2 COL4:Phone2 COL5:6
ConnectionNoParam COL2:off_hook( ) COL3:Phone2 COL4:Port2 COL5:7
ConnectionNoParam COL2:connect(String) COL3:Port2 COL4:Port1 COL5:8
ConnectionNoParam COL2:connection(String) COL3:Port2 COL4:Phone2 COL5:10
BusyConnection COL2:off_hook( ) COL3:Phone1 COL4:Port1 COL5:0
BusyConnection COL2:dial_tone( ) COL3:Port1 COL4:Phone1 COL5:1
BusyConnection COL2:dial_no(1) COL3:Phone1 COL4:Port1 COL5:2
BusyConnection COL2:dial_no(2) COL3:Phone1 COL4:Port1 COL5:3
BusyConnection COL2:dial_no(3) COL3:Phone1 COL4:Port1 COL5:4
BusyConnection COL2:busy_tone( ) COL3:Port1 COL4:Phone1 COL5:5


	The roles.out file:
Port1:PCO
Phone1:TestObject
Phone2:TestObject
Port2:PCO


	I want to generate a test case in erlang, using the bt-toolbox
(which is actually only found in the Ericsson database, restricted access).
	er_test_SUITE.erl , Basic test of Event Recording.
	Commands:
	PROC: Creates test procedure heading/log file/export function
	PATTERN: Create sting pattern to match
	TRACE: Write expression to log file
	VERIFY: Compare string pattern with log file
	Extract from this, with the units nonera_c (Test Object),
nsw_gx(stub), ncs_SystemWorker(stub):

	PROC set_er_new_extid

	Fun1 = fun(Arg1) -> {fault, my_cid, [Arg1], my node} end,
	Fun2 = fun(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) -> {ok,void} end,

	bt:stub_start ( ),
	bt:stub_fun_def (nsw_gx, get_X_data_given_extId, Fun1) , 
	bt:stub_fun_def (ncs_SystemWorker, cast, Fun2) ,

	mnesia:delete_table(er_data),
	nonera_c:start_restart(void, 130, create, no_args),
	nonera_c:set_event_recording(void, "IMSI, 12345", ["GPRSAttach,
true", "GPRSDetach, false", "GPRSTest, true"], my_log),

	bt:stub_stop( ),
	Key = mnesia:dirty_first(er_data),
	TRACE mnesia:dirty_read({er_data, Key}),
	PATTERN "no_cid"
	VERIFY
	TRACE_END


	The ptl-summary and the roles.out files should then be parsed, and
testcases be generated for each event.
	The testcases will be different depending on who is Test Object, who
is PCO, who is stub etc., and these are defined in the Roles.out file.

	Of course, Perl will be easier, but the original idea was to
implement this in Erlang.
	I've been working on this for a couple of weeks now, and it's rather
easy to adapt the basic framework in the example above to a given set of
units and messages. The real problem lies in making the erlang program
universally able to read ANY ptl-summary file and generate testcases for
each and every event, creating the stubs etc. 
	Thanks for all the help!


> Børge A. Fagerli
> Software Engineer, Professional Services
> Telelogic Norge AS, Haakon VIIs gt 7A, N-7041 Trondheim, Norway
> 
> Tel.no: +47 73 10 50 26, Mobile: +47 97 11 35 05, Fax: +47 73 10 50 01
> 



More information about the erlang-questions mailing list