Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cc4e597

Browse filesBrowse files
authored
bdd labels from tags (via allure-framework#315)
1 parent 62a2194 commit cc4e597
Copy full SHA for cc4e597

45 files changed

+635-722Lines changed: 635 additions & 722 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file
+21Lines changed: 21 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
3+
.. code:: robotframework
4+
5+
*** Settings ***
6+
Library AllureLibrary
7+
8+
*** Test Cases ***
9+
Data Attachment
10+
Attach Hello world
11+
12+
13+
.. code:: robotframework
14+
15+
*** Settings ***
16+
Library AllureLibrary
17+
18+
*** Test Cases ***
19+
Data Attachment With Name And Type
20+
Attach https://github.com/allure-framework/allure2 https://github.com/allure-framework/allure-python
21+
... name=links attachment_type=URI_LIST
Collapse file
+8Lines changed: 8 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.. code:: robotframework
2+
3+
*** Settings ***
4+
Library AllureLibrary
5+
6+
*** Test Cases ***
7+
File Attachment
8+
Attach File ${SUITE SOURCE}
Collapse file
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import os
2+
from tempfile import mkdtemp
3+
4+
5+
class ForeignLibrary(object):
6+
7+
def capture_page_screenshot(self):
8+
tmp = mkdtemp()
9+
screenshot_path = os.path.join(tmp, 'screenshot.txt')
10+
with open(screenshot_path, 'w+') as screenshot:
11+
screenshot.write("Grab some beer and be happy~(^o^)-c[~]")
12+
return screenshot_path
13+
14+
15+
foreign_library = ForeignLibrary
Collapse file
+22Lines changed: 22 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
For example, you have a something like a Selenium library. Lets define some stub for it:
3+
4+
.. literalinclude:: ./foreign_library.py
5+
6+
7+
make helper as you project scope library:
8+
9+
.. literalinclude:: ./foreign_library_helper.py
10+
11+
12+
and finally your test writen for foreign library works and makes attachments to allure report:
13+
14+
.. code:: robotframework
15+
16+
*** Settings ***
17+
Library ./foreign_library.py
18+
Library ./foreign_library_helper.py
19+
20+
*** Test Cases ***
21+
Override Library Keyword And Make Allure Attachment
22+
Capture Page Screenshot
Collapse file
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import allure
2+
from robot.libraries.BuiltIn import BuiltIn
3+
4+
5+
class ForeignLibraryHelper(object):
6+
ROBOT_LIBRARY_SCOPE = "TEST SUITE"
7+
ROBOT_LISTENER_API_VERSION = 2
8+
9+
def __init__(self):
10+
self.ROBOT_LIBRARY_LISTENER = self
11+
12+
def _start_suite(self, name, attrs):
13+
BuiltIn().set_library_search_order('foreign_library_helper')
14+
15+
def capture_page_screenshot(self):
16+
helper_library = BuiltIn().get_library_instance('foreign_library')
17+
path = helper_library.capture_page_screenshot()
18+
allure.attach.file(path, name="screenshot", attachment_type=allure.attachment_type.TEXT)
19+
return path
20+
21+
22+
foreign_library_helper = ForeignLibraryHelper
Collapse file
+34Lines changed: 34 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
Allure supports text case description. All next examples are valid:
3+
4+
.. code:: robotframework
5+
6+
*** Test Cases ***
7+
Single Line Description
8+
[Documentation] Single line description
9+
No Operation
10+
11+
12+
.. code:: robotframework
13+
14+
*** Test Cases ***
15+
Multi Line Description
16+
[Documentation] Multi line
17+
... description
18+
No Operation
19+
20+
21+
.. code:: robotframework
22+
23+
*** Test Cases ***
24+
Dynamic Description
25+
[Documentation] Static description
26+
Set Test Documentation Dynamic description
27+
28+
29+
.. code:: robotframework
30+
31+
*** Test Cases ***
32+
Append Dynamic Description
33+
[Documentation] Static description
34+
Set Test Documentation Dynamic description append=yes
Collapse file
+46Lines changed: 46 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
Allure report contains all next fixtures:
3+
4+
5+
6+
.. code:: robotframework
7+
8+
*** Keywords ***
9+
Passed Setup
10+
No Operation
11+
12+
Failed Setup
13+
Fail
14+
15+
Passed Teardown
16+
No Operation
17+
18+
Failed Teardown
19+
Fail
20+
21+
*** Test Cases ***
22+
Test Case With Test Setup
23+
[Setup] Passed Setup
24+
No Operation
25+
26+
Test Case With Failed Test Setup
27+
[Setup] Failed Setup
28+
No Operation
29+
30+
Test Case With Test Teardown
31+
[Teardown] Passed Teardown
32+
No Operation
33+
34+
Test Case With Failed Test Teardown
35+
[Teardown] Failed Teardown
36+
No Operation
37+
38+
Test Case With Test Setup And Teardown
39+
[Setup] Passed Setup
40+
[Teardown] Passed Teardown
41+
No Operation
42+
43+
Test Case With Test Failed Setup And Teardown
44+
[Setup] Failed Setup
45+
[Teardown] Failed Teardown
46+
No Operation
Collapse file
+5Lines changed: 5 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
.. code:: robotframework
3+
4+
*** Settings ***
5+
Force Tags epic:Tag
Collapse file
+10Lines changed: 10 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
.. code:: robotframework
3+
4+
*** Settings ***
5+
Force Tags feature:Label
6+
7+
*** Test Case ***
8+
Test Cases With BDD Labels
9+
[Tags] story:Test case BDD labels
10+
No Operation
Collapse file
+19Lines changed: 19 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Severity
2+
--------
3+
4+
Allure utilize a native severity, for example, we have two test cases with different tags:
5+
6+
.. code:: robotframework
7+
8+
*** Test Cases ***
9+
Test Case With Tag Alpha
10+
[Tags] alpha
11+
No Operation
12+
13+
Test Case With Tag Bravo
14+
[Tags] bravo
15+
No Operation
16+
17+
18+
In case, when we run it with option ``--critical=alpha``, first test case will be marked as critical. The same result
19+
gets when use ``--noncritical=bravo``.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.