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
79e52bf4
Commit
79e52bf4
authored
Dec 27, 2012
by
Petar Shomov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xunit plugin does not throw exception when missing step definition
parent
b25b4841
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
2 deletions
+21
-2
lettuce/plugins/xunit_output.py
+5
-2
tests/functional/output_features/missing_steps/missing_steps.feature
+3
-0
tests/functional/test_xunit_output.py
+13
-0
No files found.
lettuce/plugins/xunit_output.py
View file @
79e52bf4
...
...
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
datetime
import
datetime
from
datetime
import
datetime
,
timedelta
from
lettuce.terrain
import
after
from
lettuce.terrain
import
before
from
xml.dom
import
minidom
...
...
@@ -56,7 +56,10 @@ def enable(filename=None):
tc
=
doc
.
createElement
(
"testcase"
)
tc
.
setAttribute
(
"classname"
,
classname
.
encode
(
'utf-8'
))
tc
.
setAttribute
(
"name"
,
step
.
sentence
.
encode
(
'utf-8'
))
tc
.
setAttribute
(
"time"
,
str
(
total_seconds
((
datetime
.
now
()
-
step
.
started
))))
try
:
tc
.
setAttribute
(
"time"
,
str
(
total_seconds
((
datetime
.
now
()
-
step
.
started
))))
except
AttributeError
:
tc
.
setAttribute
(
"time"
,
str
(
total_seconds
(
timedelta
(
seconds
=
0
))))
if
not
step
.
ran
:
skip
=
doc
.
createElement
(
"skipped"
)
...
...
tests/functional/output_features/missing_steps/missing_steps.feature
0 → 100644
View file @
79e52bf4
Feature
:
Missing steps do not cause the xunit plugin to throw
Scenario
:
It should pass
Given
my sdfsdf sdfsdf sdfs df sdfsdf
tests/functional/test_xunit_output.py
View file @
79e52bf4
...
...
@@ -120,4 +120,17 @@ def test_xunit_output_with_unicode_characters_in_error_messages():
assert_equals
(
1
,
len
(
called
),
"Function not called"
)
xunit_output
.
wrt_output
=
old
@with_setup
(
prepare_stdout
,
registry
.
clear
)
def
test_xunit_does_not_throw_exception_when_missing_step_definition
():
def
dummy_write
(
filename
,
content
):
pass
old
=
xunit_output
.
wrt_output
xunit_output
.
wrt_output
=
dummy_write
runner
=
Runner
(
feature_name
(
'missing_steps'
),
enable_xunit
=
True
,
xunit_filename
=
"mising_steps.xml"
)
runner
.
run
()
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