~joetalbott/ubuntu-ci-services-itself/webui_ticket_ordering

« back to all changes in this revision

Viewing changes to docs/usage.rst

  • Committer: Chris Johnston
  • Author(s): Vincent Ladeuil
  • Date: 2014-03-13 18:48:18 UTC
  • mfrom: (381.1.2 1290401-doc-subunit)
  • Revision ID: chris_johnston-20140313184818-umlfjk7hwo14brib
[r=Francis Ginther, PS Jenkins bot] Document subunit usage from the streams produced by the test runner. 1290401 from Vincent Ladeuil

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
 
53
53
Once a ticket is completed, it's status will be updated appropriately and all
54
54
build and test results and logs will be available via the web interface.
 
55
 
 
56
 
 
57
Exploiting Test Results
 
58
-----------------------
 
59
 
 
60
The test runner produces results in the subunit v1 format.
 
61
 
 
62
The subunit stream can be downloaded from the web interface and processed
 
63
locally in different ways.
 
64
 
 
65
Note that the subunit stream contains the dep-8 test results.
 
66
 
 
67
The subunit v1 format is text only and as such can be read but it's not
 
68
especially user-friendly:
 
69
 
 
70
.. code-block:: none
 
71
 
 
72
  test: dsc0t-build
 
73
  successful: dsc0t-build [ multipart
 
74
  Content-Type: text/plain;charset=utf8
 
75
  stderr
 
76
  0^M
 
77
  Content-Type: text/plain;charset=utf8
 
78
  stdout
 
79
  12^M
 
80
  build: OK
 
81
  run: OK
 
82
  0^M
 
83
  ]
 
84
 
 
85
subunit provide filters to convert a stream into more readable outputs.
 
86
 
 
87
 
 
88
Converting to the python unittest format
 
89
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
90
 
 
91
.. code-block:: none
 
92
 
 
93
  $ subunit-1to2  <subunit.stream | subunit2pyunit
 
94
 
 
95
This filter is appropriate to inspect failures in tests and will produce
 
96
(for example):
 
97
 
 
98
.. code-block:: none
 
99
 
 
100
  $ subunit-1to2  <fail.stream | subunit2pyunit
 
101
  tests.test_pass
 
102
  tests.test_pass ... ok
 
103
  tests.test_fail
 
104
  tests.test_fail ... FAIL
 
105
  ======================================================================
 
106
  FAIL: tests.test_fail
 
107
  tests.test_fail
 
108
  ----------------------------------------------------------------------
 
109
  testtools.testresult.real._StringException: Traceback (most recent call last):
 
110
    File "tests.py", line 31, in test_fail
 
111
      self.assertTrue(False)
 
112
    File "/usr/lib/python2.7/unittest/case.py", line 424, in assertTrue
 
113
      raise self.failureException(msg)
 
114
  AssertionError: False is not true
 
115
   
 
116
   
 
117
  ----------------------------------------------------------------------
 
118
  Ran 2 tests in 0.001s
 
119
   
 
120
  FAILED (failures=1)
 
121
 
 
122
 
 
123
Converting to the junitxml format
 
124
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
125
 
 
126
.. code-block:: none
 
127
 
 
128
  $ subunit-1to2  <subunit.stream | subunit2junitxml >results.xml
 
129
 
 
130
This produces a 'results.xml' file suitable for jenkins.
 
131