Easy Extend
|
|
|
|
Author: Kay
Schluehr Date: 2007-07-24 Version: 0.2 |
IntroductionIn a Test Driven Development (TDD) approach to software development writing testcases is part of detail design and detail planning activities. What is sometimes missing in discussions about agility in particular about early phases, is an explorative element in software construction happening within live sessions. Those are available in languages supporting a REPL ( read-eval-print-loop) such as Lisp, Ruby, Python but also OCaml, Haskell or Scala. Instead of wasting information gained in these sessions after shutting them down an EE console uses a simple ( and optional ) session recorder and (re-)player and intercepts certain selected commands during re-play. This enables dirty testscripts and throwaway tests. EE console tests might apply when using a Python testframework is still too heavyweight.1. Recorder & Player
Console tests are based on recording and replaying
interactive sessions. These sessions can be interrupted and continued.
The report |
Path | EasyExtend/fibers/<fiber-name>/fibercon |
Extension |
ees |
Command |
Recorded console file |
python
fiber.py --rec |
<fiber-name>.ees Console name is used as report name. |
python
fiber.py --rec enum
|
<fiber-name>_<count>.ees where count is the current number of ees files in the fibercon directory + 1. |
python fiber.py --rec +suffix
|
<fiber-name>_suffix.ees Freely selectable suffix that is appended to the console name. |
python fiber.py --rec prefix+ | prefix_<fiber-name>.ees Freely selectable prefix that is prepended to the console name. |
python fiber.py --rec name |
name Arbitrary name without any restrictions. |
__________________________________________________________________________________________________________ Gallery On Python 2.4.3 Stackless 3.1b3 060516 (#69, Sep 7 2006, 12:45:31) [MSC v.1310 32 bit (Intel)] Fiber documentation: www.fiber-space.de/EasyExtend/doc/gallery/gallery.html Creates session report Gallery_4.ees __________________________________________________________________________________________________________ gal> |
Interrupt
replay (without command execution) |
?
|
placed before prompt as in ?>>> 1+2
|
||
Continue replay | ! | first character typed on the prompt >>> ! |
||
Interrupt replay
(with command execution) |
?! | placed before prompt as in ?!>>> 1+2 Command 1+2 is executed before switching in interactive mode |
Command |
Recorded and replayed console file |
python
fiber.py --rec --rep option |
<fiber-name>_<option>.ees Replays console session and re-records it. This enables extending an existing recorded session by new commands. |
__________________________________________________________________________________________________________ Gallery On Python 2.4.3 Stackless 3.1b3 060516 (#69, Sep 7 2006, 12:45:31) [MSC v.1310 32 bit (Intel)] Fiber documentation: www.fiber-space.de/EasyExtend/doc/gallery/gallery.html Replay session Gallery.ees __________________________________________________________________________________________________________ gal> import sys gal> sys.last_value Traceback (most recent call last): File "<input>", line 1, in ? AttributeError: 'module' object has no attribute 'last_value' ?!gal> assert raises(AttributeError, lambda: 1/0) # assertion 1 Traceback (most recent call last): File "<input>", line 1, in ? File "C:\lang\python24\lib\site-packages\EasyExtend\eeconsole.py", line 482, in raises func(*args, **kwd) File "<input>", line 1, in <lambda> ZeroDivisionError: integer division or modulo by zero gal> ! gal> assert raises(ZeroDivisionError, lambda: 1/0) # assertion 2 gal> __________________________________________________________________________________________________ --------------------. Recorded assertions | ------------------------------------------------------------------------------------------------- Status |ees ln |repl ln| Assertion -------+-------+-------+------------------------------------------------------------------------- ERROR | 11 | 14 | assert raises(AttributeError, lambda: 1/0) OK | 12 | 21 | assert raises(ZeroDivisionError, lambda: 1/0) -------+-------+-------+-------------------------------------------------------------------------- |
exception, func, *args, **kwd) |