The cl-junit-xml Reference Manual

Table of Contents

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 2.4 "Will Decker" on Wed Jun 20 11:11:52 2018 GMT+0.


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

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))

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

2 Systems

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


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

2.1 cl-junit-xml

Author

Ryan Davis <ryan@acceleration.net>

License

MIT

Description

Small library for writing junit XML files

Dependencies
Source

cl-junit-xml.asd (file)

Components

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

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 files   [Contents][Index]

3.1.1 cl-junit-xml.asd

Location

cl-junit-xml.asd

Systems

cl-junit-xml (system)


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

3.1.2 cl-junit-xml/package.lisp

Parent

cl-junit-xml (system)

Location

package.lisp

Packages

cl-junit-xml


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

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

Dependency

package.lisp (file)

Parent

cl-junit-xml (system)

Location

cl-junit-xml.lisp

Exported Definitions
Internal Definitions

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

4 Packages

Packages are listed by definition order.


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

4.1 cl-junit-xml

Source

package.lisp (file)

Use List
Exported Definitions
Internal Definitions

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

5 Definitions

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


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

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Functions

Function: make-junit &key TESTSUITES
Package

cl-junit-xml

Source

cl-junit-xml.lisp (file)

Function: make-testcase NAME CLASS-NAME DURATION &key ERROR FAILURE
Package

cl-junit-xml

Source

cl-junit-xml.lisp (file)

Function: make-testsuite NAME &key TESTCASES TIMESTAMP PACKAGE
Package

cl-junit-xml

Source

cl-junit-xml.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Generic functions

Generic Function: add-child PARENT CHILD
Package

cl-junit-xml

Source

cl-junit-xml.lisp (file)

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 (file)

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

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

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [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 (file)

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 Function: duration OBJECT
Package

cl-junit-xml

Methods
Method: duration (JUNIT-TESTCASE junit-testcase)

automatically generated reader method

Source

cl-junit-xml.lisp (file)

Generic Function: error-text OBJECT
Package

cl-junit-xml

Methods
Method: error-text (JUNIT-TESTCASE junit-testcase)

automatically generated reader method

Source

cl-junit-xml.lisp (file)

Generic Function: failure-text OBJECT
Package

cl-junit-xml

Methods
Method: failure-text (JUNIT-TESTCASE junit-testcase)

automatically generated reader method

Source

cl-junit-xml.lisp (file)

Generic Function: name OBJECT
Package

cl-junit-xml

Methods
Method: name (JUNIT-TESTCASE junit-testcase)

automatically generated reader method

Source

cl-junit-xml.lisp (file)

Method: name (JUNIT-TESTSUITE junit-testsuite)

automatically generated reader method

Source

cl-junit-xml.lisp (file)

Generic Function: pkg OBJECT
Package

cl-junit-xml

Methods
Method: pkg (JUNIT-TESTSUITE junit-testsuite)

automatically generated reader method

Source

cl-junit-xml.lisp (file)

Generic Function: testcases OBJECT
Generic Function: (setf testcases) NEW-VALUE OBJECT
Package

cl-junit-xml

Methods
Method: testcases (JUNIT-TESTSUITE junit-testsuite)

automatically generated reader method

Source

cl-junit-xml.lisp (file)

Method: (setf testcases) NEW-VALUE (JUNIT-TESTSUITE junit-testsuite)

automatically generated writer method

Source

cl-junit-xml.lisp (file)

Generic Function: testsuites OBJECT
Generic Function: (setf testsuites) NEW-VALUE OBJECT
Package

cl-junit-xml

Methods
Method: testsuites (JUNIT-XML junit-xml)

automatically generated reader method

Source

cl-junit-xml.lisp (file)

Method: (setf testsuites) NEW-VALUE (JUNIT-XML junit-xml)

automatically generated writer method

Source

cl-junit-xml.lisp (file)

Generic Function: timestamp OBJECT
Package

cl-junit-xml

Methods
Method: timestamp (JUNIT-TESTSUITE junit-testsuite)

automatically generated reader method

Source

cl-junit-xml.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Classes

Class: junit-testcase ()
Package

cl-junit-xml

Source

cl-junit-xml.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: name
Initargs

:name

Readers

name (generic function)

Slot: duration
Initargs

:duration

Readers

duration (generic function)

Slot: class-name
Initargs

:class-name

Readers

class-name (generic function)

Slot: error-text
Initargs

:error-text

Readers

error-text (generic function)

Slot: failure-text
Initargs

:failure-text

Readers

failure-text (generic function)

Class: junit-testsuite ()
Package

cl-junit-xml

Source

cl-junit-xml.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: testcases
Initargs

:testcases

Readers

testcases (generic function)

Writers

(setf testcases) (generic function)

Slot: name
Initargs

:name

Readers

name (generic function)

Slot: pkg
Initargs

:package

Readers

pkg (generic function)

Slot: timestamp
Initargs

:timestamp

Readers

timestamp (generic function)

Class: junit-xml ()
Package

cl-junit-xml

Source

cl-junit-xml.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: testsuites
Initargs

:testsuites

Readers

testsuites (generic function)

Writers

(setf testsuites) (generic function)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   C   F   L  
Index Entry  Section

C
cl-junit-xml.asd: The cl-junit-xml<dot>asd file
cl-junit-xml/cl-junit-xml.lisp: The cl-junit-xml/cl-junit-xml<dot>lisp file
cl-junit-xml/package.lisp: The cl-junit-xml/package<dot>lisp file

F
File, Lisp, cl-junit-xml.asd: The cl-junit-xml<dot>asd file
File, Lisp, cl-junit-xml/cl-junit-xml.lisp: The cl-junit-xml/cl-junit-xml<dot>lisp file
File, Lisp, cl-junit-xml/package.lisp: The cl-junit-xml/package<dot>lisp file

L
Lisp File, cl-junit-xml.asd: The cl-junit-xml<dot>asd file
Lisp File, cl-junit-xml/cl-junit-xml.lisp: The cl-junit-xml/cl-junit-xml<dot>lisp file
Lisp File, cl-junit-xml/package.lisp: The cl-junit-xml/package<dot>lisp file

Jump to:   C   F   L  

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

A.2 Functions

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

%
%write-xml: Internal generic functions
%write-xml: Internal generic functions
%write-xml: Internal generic functions
%write-xml: Internal generic functions

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

A
add-child: Exported generic functions
add-child: Exported generic functions
add-child: Exported generic functions

D
duration: Internal generic functions
duration: Internal generic functions

E
error-text: Internal generic functions
error-text: Internal generic functions

F
failure-text: Internal generic functions
failure-text: Internal generic functions
Function, make-junit: Exported functions
Function, make-testcase: Exported functions
Function, make-testsuite: Exported functions

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

M
make-junit: Exported functions
make-testcase: Exported functions
make-testsuite: Exported functions
Method, %write-xml: Internal generic functions
Method, %write-xml: Internal generic functions
Method, %write-xml: Internal generic functions
Method, (setf testcases): Internal generic functions
Method, (setf testsuites): Internal generic functions
Method, add-child: Exported generic functions
Method, add-child: Exported generic functions
Method, duration: Internal generic functions
Method, error-text: Internal generic functions
Method, failure-text: Internal generic functions
Method, name: Internal generic functions
Method, name: Internal generic functions
Method, pkg: Internal generic functions
Method, testcases: Internal generic functions
Method, testsuites: Internal generic functions
Method, timestamp: Internal generic functions
Method, write-xml: Exported generic functions
Method, write-xml: Exported generic functions
Method, write-xml: Exported generic functions
Method, write-xml: Exported generic functions

N
name: Internal generic functions
name: Internal generic functions
name: Internal generic functions

P
pkg: Internal generic functions
pkg: Internal generic functions

T
testcases: Internal generic functions
testcases: Internal generic functions
testsuites: Internal generic functions
testsuites: Internal generic functions
timestamp: Internal generic functions
timestamp: Internal generic functions

W
write-xml: Exported generic functions
write-xml: Exported generic functions
write-xml: Exported generic functions
write-xml: Exported generic functions
write-xml: Exported generic functions

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

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

A.3 Variables

Jump to:   C   D   E   F   N   P   S   T  
Index Entry  Section

C
class-name: Internal classes

D
duration: Internal classes

E
error-text: Internal classes

F
failure-text: Internal classes

N
name: Internal classes
name: Internal classes

P
pkg: Internal classes

S
Slot, class-name: Internal classes
Slot, duration: Internal classes
Slot, error-text: Internal classes
Slot, failure-text: Internal classes
Slot, name: Internal classes
Slot, name: Internal classes
Slot, pkg: Internal classes
Slot, testcases: Internal classes
Slot, testsuites: Internal classes
Slot, timestamp: Internal classes

T
testcases: Internal classes
testsuites: Internal classes
timestamp: Internal classes

Jump to:   C   D   E   F   N   P   S   T  

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

A.4 Data types

Jump to:   C   J   P   S  
Index Entry  Section

C
cl-junit-xml: The cl-junit-xml system
cl-junit-xml: The cl-junit-xml package
Class, junit-testcase: Internal classes
Class, junit-testsuite: Internal classes
Class, junit-xml: Internal classes

J
junit-testcase: Internal classes
junit-testsuite: Internal classes
junit-xml: Internal classes

P
Package, cl-junit-xml: The cl-junit-xml package

S
System, cl-junit-xml: The cl-junit-xml system

Jump to:   C   J   P   S