Skip to content

Commit

Permalink
Added custom field 'Type' (#94)
Browse files Browse the repository at this point in the history
testimony can now parse custom field called 'Type' which takes
argument as one of the - Functional, Non-functional, Structural

Partly fixes: #90

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
  • Loading branch information
Akasurde authored and omaciel committed May 5, 2016
1 parent adbce9f commit 9140a08
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions testimony/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def __init__(self, function_def, parent_class=None, testmodule=None):
self.steps = None
self.tags = None
self.test = None
self.test_type = None
self.skipped_lines = []
self._parse_docstring()

Expand Down Expand Up @@ -134,6 +135,8 @@ def _parse_docstring(self):
self.steps = value
elif tag == 'tags':
self.tags = value
elif tag == 'type':
self.test_type = value
else:
self.skipped_lines.append(line)

Expand Down Expand Up @@ -176,6 +179,7 @@ def to_dict(self):
'steps': self.steps,
'tags': self.tags,
'test': self.test,
'test_type': self.test_type
}

def __str__(self):
Expand All @@ -196,6 +200,8 @@ def __str__(self):
output.append('Status: ' + self.status)
if self.tags is not None:
output.append('Tags: ' + self.tags)
if self.test_type is not None:
output.append('Type: ' + self.test_type)
if self.skipped_lines:
output.append(
'Skipped lines:\n' +
Expand Down
5 changes: 5 additions & 0 deletions tests/sample_output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Skipped lines:
Feture: Login - Positive
Bug: 123456
Statues: Manual
Types: Functional

TC 2
Test: Login with Latin credentials
Expand Down Expand Up @@ -75,6 +76,7 @@ Steps: 1. Login to the application with invalid credentials
Bugs: 123456
Status: Manual
Tags: t3
Type: Functional


================
Expand All @@ -93,6 +95,7 @@ Skipped lines:
Feture: Login - Positive
Bug: 123456
Statues: Manual
Types: Functional

TC 2

Expand Down Expand Up @@ -127,6 +130,7 @@ Steps: 1. Login to the application with invalid credentials
Bugs: 123456
Status: Manual
Tags: t3
Type: Functional

TC 7
Test: Login with invalid credentials
Expand Down Expand Up @@ -165,6 +169,7 @@ test_positive_login_1
Feture: Login - Positive
Bug: 123456
Statues: Manual
Types: Functional

test_positive_login_2
---------------------
Expand Down
2 changes: 2 additions & 0 deletions tests/test_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def test_positive_login_1(self):
@Tags: t1, t2, t3
@Types: Functional
"""
# Code to perform the test
pass
Expand Down Expand Up @@ -112,6 +113,7 @@ def test_negative_login_6(self):
@Tags: t3
@Type: Functional
"""
# Code to perform the test
pass
Expand Down

0 comments on commit 9140a08

Please sign in to comment.