;;;; Purpose: Example file for XLTest
;;;; Authors: Kevin Rosenberg and Craig Brozefsky
;;;;
-;;;; Put in public domain by Kevin Rosenberg and onShore, Inc
-;;;; $Id: example.lisp,v 1.1 2003/08/04 06:00:01 kevin Exp $
+;;;; $Id: example.lisp,v 1.2 2003/08/04 09:46:44 kevin Exp $
;;;; *************************************************************************
(defpackage #:xltest-example
(:use #:cl #:xltest)
- (:export
- #:math-test-suite))
+ (:export #:math-test-suite))
(in-package #:xltest-example)
;;; during testing. Often there are many test cases that use the same
;;; data. Each of these test cases is an instance of a test-fixture.
-(def-test-fixture math-fixture ()
- ((numbera
- :accessor numbera)
- (numberb
- :accessor numberb))
+(defclass math-fixture (test-fixture)
+ ((numbera :accessor numbera)
+ (numberb :accessor numberb))
(:documentation "Test fixture for math testing"))
;;; Then we define a setup method for the fixture. This method is run
(let ((result (- (numbera test) (numberb test))))
(assert-equal result 1)))
-
-;;; Now we can create a test-suite. A test-suite contains a group of
-;;; test-cases (instances of test-fixture) and/or other test-suites.
-;;; We can specify which tests are in a test-suite when we define the
-;;; test-suite, or we can add them later. See the documentation and
-;;; argument list for make-test-case for details on how to specify a
-;;; test-case.
-
-(defparameter *manual-math-test-suite*
- (make-test-suite
- "Math Test Suite"
- "Simple test suite for arithmetic operators."
- '(("Addition Test" math-fixture
- :test-thunk test-addition
- :description "A simple test of the + operator")
- ("Subtraction Test" math-fixture
- :test-thunk test-subtraction
- :description "A simple test of the - operator"))))
-
-(add-test (make-test-case "Subtraction Test 2" 'math-fixture
- :test-thunk 'test-subtraction-2
- :description "A broken substraction test, should fail.")
- *manual-math-test-suite*)
-
-
-(defparameter *dynamic-math-test-suite* (make-test-suite 'math-fixture))
-
;;;; Finally we can run our test suite and see how it performs.
-(report-result (run-test *manual-math-test-suite*
- :handle-errors t) :verbose t)
+(text-testrunner (make-test-suite 'math-fixture))
-(report-result (run-test *dynamic-math-test-suite*
- :handle-errors t) :verbose nil)