The cl-junit-xml Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-junit-xml Reference Manual

This is the cl-junit-xml Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 03:45:12 2022 GMT+0.

Table of Contents


1 Introduction

cl-junit-xml

Small library for writing junit-compatible XML files.

Example

CL-JUNIT-XML> (let* ((junit (make-junit))
       (suite (add-child junit (make-testsuite "suite" :timestamp "now"))))
  (add-child suite (make-testcase "test" "class" 1.0
                                  :failure "invalid assertion"))
  (add-child suite (make-testcase "test 2" "class" 2.0
                                  :error "problem running the test"))
  (add-child suite (make-testcase "test 3" "class" 5.0))
  (write-xml junit T :pretty-p T))
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="suite" timestamp="now" id="0" tests="3" errors="1" failures="1" time="8.0">
  <testcase name="test 3" classname="class" time="5.0"/>
  <testcase name="test 2" classname="class" time="2.0">
    <error>
      <![CDATA[problem running the test]]></error>
  </testcase>
  <testcase name="test" classname="class" time="1.0">
    <failure>
      <![CDATA[invalid assertion]]></failure>
  </testcase>
</testsuite>

API

make-junit

creates a new junit root XML object you can add suites to

make-testsuite

creates a new junit testsuite add testcases to

make-testcase

creates a new junit testcase

(add-child parent child)

add cases to suites, and suites to junit. returns the child

(write-xml junit sink &key pretty-p &allow-other-keys)

writes the junit XML to the given sink. Supports sinks of:

if pretty-p is non-nil, then the XML produced is indented.

Other keys are allowed to support integration with other testing libraries.

Integration with other testing libraries

lisp-unit2

lisp-unit2 support is available via the cl-junit-xml.lisp-unit2 ASDF system, and adds some additional write-xml specializations for lisp-unit2 objects.

Any dots (.) in test names will be read as part of the classname for junit, which affects rendering in systems like Jenkins.

For example, assuming you start with (lisp-unit2:run-tests :name :my-tests):

writing XML directly

(write-xml (lisp-unit2:run-tests :name :my-tests) T :pretty-p T)

writing XML via the lisp-unit2's signals:

(handler-bind
    ((lisp-unit2:all-tests-complete
       #'(lambda (c)
           (write-xml c T :pretty-p T))))
  (lisp-unit2:run-tests :name :my-tests))

lisp-unit

lisp-unit support is available via the cl-junit-xml.lisp-unit ASDF system, and adds some additional write-xml specializations for lisp-unit objects.

Adds a :name keyword arg to write-xml that will be used as the default XML classname.

Classname handling is similar to lisp-unit2. For example, assuming you start with (write-xml test-results T :name :my-tests):

writing XML via the lisp-unit's signals:

(handler-bind
    ((lisp-unit:tests-run-complete
       #'(lambda (c)
       (write-xml c T :pretty-p T :name "my-tests"))))
  (lisp-unit:signal-results)
  (lisp-unit:run-tests))

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 cl-junit-xml

Small library for writing junit XML files

Author

Ryan Davis <ryan@acceleration.net>

License

MIT

Dependencies
  • cxml (system).
  • iterate (system).
  • alexandria (system).
Source

cl-junit-xml.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 cl-junit-xml/cl-junit-xml.asd

Source

cl-junit-xml.asd.

Parent Component

cl-junit-xml (system).

ASDF Systems

cl-junit-xml.


3.1.2 cl-junit-xml/package.lisp

Source

cl-junit-xml.asd.

Parent Component

cl-junit-xml (system).

Packages

cl-junit-xml.


3.1.3 cl-junit-xml/cl-junit-xml.lisp

Dependency

package.lisp (file).

Source

cl-junit-xml.asd.

Parent Component

cl-junit-xml (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 cl-junit-xml

Source

package.lisp.

Use List
  • common-lisp.
  • iterate.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Ordinary functions

Function: make-junit (&key testsuites)
Package

cl-junit-xml.

Source

cl-junit-xml.lisp.

Function: make-testcase (name class-name duration &key error failure)
Package

cl-junit-xml.

Source

cl-junit-xml.lisp.

Function: make-testsuite (name &key testcases timestamp package)
Package

cl-junit-xml.

Source

cl-junit-xml.lisp.


5.1.2 Generic functions

Generic Function: add-child (parent child)
Package

cl-junit-xml.

Source

cl-junit-xml.lisp.

Methods
Method: add-child ((p junit-xml) (c junit-testsuite))
Method: add-child ((p junit-testsuite) (c junit-testcase))
Generic Function: write-xml (junit-xml sink &key pretty-p &allow-other-keys)

write the junit to the given sink (string, pathname, T, nil)

Package

cl-junit-xml.

Source

cl-junit-xml.lisp.

Methods
Method: write-xml (junit-xml (sink string) &key pretty-p &allow-other-keys)
Method: write-xml (junit-xml sink &key pretty-p &allow-other-keys)
Method: write-xml (junit-xml (sink pathname) &key pretty-p &allow-other-keys)
Method: write-xml (junit-xml (sink null) &key pretty-p &allow-other-keys)

5.1.3 Standalone methods

Reader Method: class-name ((junit-testcase junit-testcase))

automatically generated reader method

Source

cl-junit-xml.lisp.

Target Slot

class-name.


5.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.1 Generic functions

Generic Function: %write-xml (thing &key sink id &allow-other-keys)
Package

cl-junit-xml.

Source

cl-junit-xml.lisp.

Methods
Method: %write-xml ((junit-xml junit-xml) &key sink &allow-other-keys)
Method: %write-xml ((suite junit-testsuite) &key id &allow-other-keys)
Method: %write-xml ((testcase junit-testcase) &key &allow-other-keys)
Generic Reader: duration (object)
Package

cl-junit-xml.

Methods
Reader Method: duration ((junit-testcase junit-testcase))

automatically generated reader method

Source

cl-junit-xml.lisp.

Target Slot

duration.

Generic Reader: error-text (object)
Package

cl-junit-xml.

Methods
Reader Method: error-text ((junit-testcase junit-testcase))

automatically generated reader method

Source

cl-junit-xml.lisp.

Target Slot

error-text.

Generic Reader: failure-text (object)
Package

cl-junit-xml.

Methods
Reader Method: failure-text ((junit-testcase junit-testcase))

automatically generated reader method

Source

cl-junit-xml.lisp.

Target Slot

failure-text.

Generic Reader: name (object)
Package

cl-junit-xml.

Methods
Reader Method: name ((junit-testcase junit-testcase))

automatically generated reader method

Source

cl-junit-xml.lisp.

Target Slot

name.

Reader Method: name ((junit-testsuite junit-testsuite))

automatically generated reader method

Source

cl-junit-xml.lisp.

Target Slot

name.

Generic Reader: pkg (object)
Package

cl-junit-xml.

Methods
Reader Method: pkg ((junit-testsuite junit-testsuite))

automatically generated reader method

Source

cl-junit-xml.lisp.

Target Slot

pkg.

Generic Reader: testcases (object)
Package

cl-junit-xml.

Methods
Reader Method: testcases ((junit-testsuite junit-testsuite))

automatically generated reader method

Source

cl-junit-xml.lisp.

Target Slot

testcases.

Generic Writer: (setf testcases) (object)
Package

cl-junit-xml.

Methods
Writer Method: (setf testcases) ((junit-testsuite junit-testsuite))

automatically generated writer method

Source

cl-junit-xml.lisp.

Target Slot

testcases.

Generic Reader: testsuites (object)
Package

cl-junit-xml.

Methods
Reader Method: testsuites ((junit-xml junit-xml))

automatically generated reader method

Source

cl-junit-xml.lisp.

Target Slot

testsuites.

Generic Writer: (setf testsuites) (object)
Package

cl-junit-xml.

Methods
Writer Method: (setf testsuites) ((junit-xml junit-xml))

automatically generated writer method

Source

cl-junit-xml.lisp.

Target Slot

testsuites.

Generic Reader: timestamp (object)
Package

cl-junit-xml.

Methods
Reader Method: timestamp ((junit-testsuite junit-testsuite))

automatically generated reader method

Source

cl-junit-xml.lisp.

Target Slot

timestamp.


Previous: , Up: Internals   [Contents][Index]

5.2.2 Classes

Class: junit-testcase
Package

cl-junit-xml.

Source

cl-junit-xml.lisp.

Direct methods
Direct slots
Slot: name
Initargs

:name

Readers

name.

Writers

This slot is read-only.

Slot: duration
Initargs

:duration

Readers

duration.

Writers

This slot is read-only.

Slot: class-name
Package

common-lisp.

Initargs

:class-name

Readers

class-name.

Writers

This slot is read-only.

Slot: error-text
Initargs

:error-text

Readers

error-text.

Writers

This slot is read-only.

Slot: failure-text
Initargs

:failure-text

Readers

failure-text.

Writers

This slot is read-only.

Class: junit-testsuite
Package

cl-junit-xml.

Source

cl-junit-xml.lisp.

Direct methods
Direct slots
Slot: testcases
Initargs

:testcases

Readers

testcases.

Writers

(setf testcases).

Slot: name
Initargs

:name

Readers

name.

Writers

This slot is read-only.

Slot: pkg
Initargs

:package

Readers

pkg.

Writers

This slot is read-only.

Slot: timestamp
Initargs

:timestamp

Readers

timestamp.

Writers

This slot is read-only.

Class: junit-xml
Package

cl-junit-xml.

Source

cl-junit-xml.lisp.

Direct methods
Direct slots
Slot: testsuites
Initargs

:testsuites

Readers

testsuites.

Writers

(setf testsuites).


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   %   (  
A   C   D   E   F   G   M   N   P   T   W  
Index Entry  Section

%
%write-xml: Private generic functions
%write-xml: Private generic functions
%write-xml: Private generic functions
%write-xml: Private generic functions

(
(setf testcases): Private generic functions
(setf testcases): Private generic functions
(setf testsuites): Private generic functions
(setf testsuites): Private generic functions

A
add-child: Public generic functions
add-child: Public generic functions
add-child: Public generic functions

C
class-name: Public standalone methods

D
duration: Private generic functions
duration: Private generic functions

E
error-text: Private generic functions
error-text: Private generic functions

F
failure-text: Private generic functions
failure-text: Private generic functions
Function, make-junit: Public ordinary functions
Function, make-testcase: Public ordinary functions
Function, make-testsuite: Public ordinary functions

G
Generic Function, %write-xml: Private generic functions
Generic Function, (setf testcases): Private generic functions
Generic Function, (setf testsuites): Private generic functions
Generic Function, add-child: Public generic functions
Generic Function, duration: Private generic functions
Generic Function, error-text: Private generic functions
Generic Function, failure-text: Private generic functions
Generic Function, name: Private generic functions
Generic Function, pkg: Private generic functions
Generic Function, testcases: Private generic functions
Generic Function, testsuites: Private generic functions
Generic Function, timestamp: Private generic functions
Generic Function, write-xml: Public generic functions

M
make-junit: Public ordinary functions
make-testcase: Public ordinary functions
make-testsuite: Public ordinary functions
Method, %write-xml: Private generic functions
Method, %write-xml: Private generic functions
Method, %write-xml: Private generic functions
Method, (setf testcases): Private generic functions
Method, (setf testsuites): Private generic functions
Method, add-child: Public generic functions
Method, add-child: Public generic functions
Method, class-name: Public standalone methods
Method, duration: Private generic functions
Method, error-text: Private generic functions
Method, failure-text: Private generic functions
Method, name: Private generic functions
Method, name: Private generic functions
Method, pkg: Private generic functions
Method, testcases: Private generic functions
Method, testsuites: Private generic functions
Method, timestamp: Private generic functions
Method, write-xml: Public generic functions
Method, write-xml: Public generic functions
Method, write-xml: Public generic functions
Method, write-xml: Public generic functions

N
name: Private generic functions
name: Private generic functions
name: Private generic functions

P
pkg: Private generic functions
pkg: Private generic functions

T
testcases: Private generic functions
testcases: Private generic functions
testsuites: Private generic functions
testsuites: Private generic functions
timestamp: Private generic functions
timestamp: Private generic functions

W
write-xml: Public generic functions
write-xml: Public generic functions
write-xml: Public generic functions
write-xml: Public generic functions
write-xml: Public generic functions

Jump to:   %   (  
A   C   D   E   F   G   M   N   P   T   W