Skip to content

Commit 4323da6

Browse files
authored
improve test (via #131)
1 parent 67e5b9e commit 4323da6

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

allure-behave/features/steps/dummy_steps.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
13
import allure
24
from behave import given
35

@@ -26,3 +28,9 @@ def step_impl(*args, **kwargs):
2628
@given(u'{what} broken step {where}')
2729
def step_impl(*args, **kwargs):
2830
raise ZeroDivisionError()
31+
32+
33+
@given(u'всегда будет <это>')
34+
@given(u'всегда буду я')
35+
def step_impl(*args, **kwargs):
36+
pass

allure-behave/features/unicode.feature

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@ Feature: Language
22
Scenario: Use russian
33
Given feature definition ru
44
"""
5-
Функционал: Язык
5+
Функционал: Юникод
66
7-
Сценарий: На русском
8-
Допустим passed step
7+
Структура сценария: Солнечный круг, небо вокруг
8+
Пусть всегда будет <это>
9+
Пусть всегда буду я
10+
Примеры:
11+
| это |
12+
| солнце |
13+
| небо |
14+
| мама |
915
"""
1016
When I run behave with allure formatter with options "--lang ru"
11-
Then allure report has a scenario with name "На русском"
17+
Then allure report has a scenario with name "Солнечный круг, небо вокруг"
18+
And scenario contains step "Пусть всегда будет солнце"
19+
And scenario contains step "Пусть всегда будет небо"
20+
And scenario contains step "Пусть всегда будет мама"
21+
And scenario contains step "Пусть всегда буду я"

allure-behave/src/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from allure_commons.model2 import Status, Parameter, Label
55
from allure_commons.model2 import StatusDetails
66
from allure_commons.utils import md5
7+
from allure_commons.utils import represent
78
import traceback
89

910
STATUS = {
@@ -86,7 +87,7 @@ def step_status(result):
8687

8788
def step_status_details(result):
8889
if result.exception:
89-
message = u','.join(map(str, result.exception.args))
90+
message = u','.join(map(represent, result.exception.args))
9091
message = u'{name}: {message}'.format(name=result.exception.__class__.__name__, message=message)
9192
trace = u'\n'.join(traceback.format_tb(result.exc_traceback)) if result.exc_traceback else None
9293
return StatusDetails(message=message, trace=trace)

0 commit comments

Comments
 (0)