[prev in list] [next in list] [prev in thread] [next in thread] 

List:       listar-dev
Subject:    [EDev] [Test Suit] 4S Proposal Draft 0.1
From:       Sascha Wilde <wilde () sha-bang ! de>
Date:       2004-04-26 20:26:06
Message-ID: 20040426202606.GA5795 () kenny ! sha-bang ! local
[Download RAW message or body]

Hello,
as my suggestion on a virtual MTA emulation as part of the test suit
seems to be welcome: here my first draft proposal on how such a beast
could be implemented.

This is still very rough, any comments, additions and suggestions are
welcome. 

Please read the whole text, some importaint thougts are at the very
end.  And please keep in mind, this is supposed to be only a tiny
part of a upcoming test suit.

------------------------------------------------------------------------
							     Draft 0.1

		   SIMPLE SCRIPTED SERVER SIMULATOR
		   ================================

short "4S" pronounced "force" :-)


1. PURPOSE:

Ecartis communicates with an MTA, so to test it we need a peace of
code to which ecartis can talk, which behaves like an MTA from ecartis
point of view.

For testing purpose its important to get logs of the stmp dialog and
especially the data send by ecartis.

Further more it should be possible do emulate the behavior of
different MTAs and error conditions.


2. CONCEPT:

A simple pseudo-server driven by scripts.  By small scripts for
different test-cases it should be possible to emulate the behavior of
different servers in certain situations.

What it should be able to do:

- Listen on any TCP-Port or BSD Socket
- Read from stream
- Wait for specific input from stream
- Echo Messages to stream
- Log anything (this is the most importaint Part)
- stall, e.g. force timeouts...

to "receive" more than one Mail we need a conditional loop, for more
flexible use I propose two statements: a unconditional jump (I call it
"loop" to discourage misuse  as "goto") and a conditional jump (if).


3. SCRIPT COMMANDS:

ECHO <string>

  Prints <string> to tcp stream.

READ [ <count> ] [ LOG <filespec> [ APPEND ] ]

  Read <count> lines (or bytes?) of input from TCP Stream.  If
  optional LOG is specified write the read data to <filespec>.
  
  If the <filespec> string contains the special string "%00" this
  will be substituted by a number, which gets incremented on each
  call.  This makes it easy to write each Mail to an one file when
  more than one Mail is sent.

  If APPEND is used and the <filespec> exists the read data is
  appended to the file.

READ UNTIL <regex> [ LOG <filespec> [ APPEND ] ]

  like READ but reads line after line until the last read line
  matches <regex>

STALL <time>

  Do nothing but block for <time> (for example to force timeouts, or
  emulate a busy server.


Float control:

<label>:
  
  Mark in script, named <label>

LOOP <label>

  Goto <label>
  
IF <regex> <label>

  If last read line matches <regex> goto <label>


4. GLOBAL OPTIONS:

-log <file>

  log complete session to <file>

-stall <time>

  default blocking time between every command

-port <num>
-interface <if-spec>
-sock <string>

  yust what one would expect... ;-)

-timeout <time>

  The READ commandos bear the risk of blocking for ever, so when this
  global timeout is set the pseudo-server will give up after <time>


5. IMPLEMENTATION CONSIDERATIONS:

Could be a standalone application or python module (or hybrid?)

The scripting language...

...can be implemented as an own scripting-language:
pro: simple, ease of use and modification 
con: inflexible, own parser must be written

...python module, so that the scripts ear actual python code:
pro: whole power of python, loops and conditional could be taken from
     native python (so no LOOP, or IF commands would be implemented) 
con: slightly more complex syntax, encourages complex tests which are
     hard to debug

------------------------------------------------------------------------

please don't mind my bad english and techwriting skills...  :-)

cheers
-- 
Sascha Wilde

A conclusion is simply the place where someone got tired of thinking.

-- Attached file included as plaintext by Ecartis --

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAjXBechutvmkRUCQRAtmvAJ0RYS2Ip8GkVh7vVrxSTCxoaCHuXgCfbdqF
5N8gBwaf8iR4Z5LAPPRzcmk=
=sRJn
-----END PGP SIGNATURE-----



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic