Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lettuce
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
lettuce
Commits
0b2fa475
Commit
0b2fa475
authored
Dec 12, 2012
by
Gabriel Falcão
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #303 from enewton/master
Fix for issue #242 "xunit dies on undefined steps" WITH TESTS!
parents
b510787b
f5042fc1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
3 deletions
+36
-3
lettuce/plugins/xunit_output.py
+5
-3
tests/functional/output_features/no_steps_defined/no_steps_defined.feature
+7
-0
tests/functional/output_features/no_steps_defined/no_steps_defined_steps.py
+0
-0
tests/functional/test_xunit_output.py
+24
-0
No files found.
lettuce/plugins/xunit_output.py
View file @
0b2fa475
...
@@ -56,10 +56,12 @@ def enable(filename=None):
...
@@ -56,10 +56,12 @@ def enable(filename=None):
tc
=
doc
.
createElement
(
"testcase"
)
tc
=
doc
.
createElement
(
"testcase"
)
tc
.
setAttribute
(
"classname"
,
classname
)
tc
.
setAttribute
(
"classname"
,
classname
)
tc
.
setAttribute
(
"name"
,
step
.
sentence
)
tc
.
setAttribute
(
"name"
,
step
.
sentence
)
tc
.
setAttribute
(
"time"
,
str
(
total_seconds
((
datetime
.
now
()
-
step
.
started
))))
if
step
.
ran
:
tc
.
setAttribute
(
"time"
,
str
(
total_seconds
((
datetime
.
now
()
-
step
.
started
))))
if
not
step
.
ran
:
else
:
tc
.
setAttribute
(
"time"
,
str
(
0
))
skip
=
doc
.
createElement
(
"skipped"
)
skip
=
doc
.
createElement
(
"skipped"
)
skip
.
setAttribute
(
"type"
,
"UndefinedStep(
%
s)"
%
step
.
sentence
)
tc
.
appendChild
(
skip
)
tc
.
appendChild
(
skip
)
if
step
.
failed
:
if
step
.
failed
:
...
...
tests/functional/output_features/no_steps_defined/no_steps_defined.feature
0 → 100644
View file @
0b2fa475
Feature
:
Scenario with no steps
As a programmer
In order practise TDD
I want to write some scenarios before writing the steps
Scenario
:
Do
nothing
Given
I do nothing
tests/functional/output_features/no_steps_defined/no_steps_defined_steps.py
0 → 100644
View file @
0b2fa475
tests/functional/test_xunit_output.py
View file @
0b2fa475
...
@@ -86,6 +86,7 @@ def test_xunit_output_with_one_error():
...
@@ -86,6 +86,7 @@ def test_xunit_output_with_one_error():
assert_equals
(
1
,
len
(
called
),
"Function not called"
)
assert_equals
(
1
,
len
(
called
),
"Function not called"
)
xunit_output
.
wrt_output
=
old
xunit_output
.
wrt_output
=
old
@with_setup
(
prepare_stdout
,
registry
.
clear
)
@with_setup
(
prepare_stdout
,
registry
.
clear
)
def
test_xunit_output_with_different_filename
():
def
test_xunit_output_with_different_filename
():
'Test xunit output with different filename'
'Test xunit output with different filename'
...
@@ -105,3 +106,26 @@ def test_xunit_output_with_different_filename():
...
@@ -105,3 +106,26 @@ def test_xunit_output_with_different_filename():
xunit_output
.
wrt_output
=
old
xunit_output
.
wrt_output
=
old
@with_setup
(
prepare_stdout
,
registry
.
clear
)
def
test_xunit_output_with_no_steps
():
'Test xunit output with no steps'
called
=
[]
def
assert_correct_xml
(
filename
,
content
):
print
filename
print
content
called
.
append
(
True
)
assert_xsd_valid
(
filename
,
content
)
root
=
etree
.
fromstring
(
content
)
assert_equals
(
root
.
get
(
"tests"
),
"1"
)
assert_equals
(
root
.
find
(
"testcase"
)
.
get
(
"name"
),
"Given I do nothing"
)
assert_equals
(
len
(
root
.
getchildren
()),
1
)
assert_equals
(
root
.
find
(
"testcase/skipped"
)
.
get
(
"type"
),
"UndefinedStep(Given I do nothing)"
)
assert_equals
(
float
(
root
.
find
(
"testcase"
)
.
get
(
"time"
)),
0
)
old
=
xunit_output
.
wrt_output
xunit_output
.
wrt_output
=
assert_correct_xml
runner
=
Runner
(
feature_name
(
'no_steps_defined'
),
enable_xunit
=
True
)
runner
.
run
()
assert_equals
(
1
,
len
(
called
),
"Function not called"
)
xunit_output
.
wrt_output
=
old
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment