Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions testit-adapter-behave/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ Use tags to specify information about autotest.

Description of tags:

- `WorkItemIds` - a method that links autotests with manual tests. Receives the array of manual tests' IDs
- `WorkItemId` - a method that links an autotest with a manual test. Receives a single globalId
- `WorkItemIds` - deprecated, use `WorkItemId` instead
- `DisplayName` - internal autotest name (used in Test IT)
- `ExternalId` - unique internal autotest ID (used in Test IT)
- `Title` - autotest name specified in the autotest card. If not specified, the name from the displayName method is used
Expand All @@ -126,7 +127,8 @@ If you want to insert a space in the tags, use the "\\_" character combination.

Description of methods:

- `testit.addWorkItemIds` - a dynamic method that links autotests with manual tests. Receives the array of manual tests' IDs
- `testit.addWorkItemId` - a dynamic method that links an autotest with a manual test. Receives a single globalId
- `testit.addWorkItemIds` - deprecated, use `testit.addWorkItemId` instead
- `testit.addDisplayName` - a dynamic method for adding internal autotest name (used in Test IT)
- `testit.addExternalId` - a dynamic method for adding unique internal autotest ID (used in Test IT)
- `testit.addTitle` - a dynamic method for adding autotest name specified in the autotest card. If not specified, the name from the displayName method is used
Expand Down Expand Up @@ -193,7 +195,7 @@ Feature: Sample

@ExternalId=failed_with_all_annotations
@DisplayName=Failed_test_with_all_annotations
@WorkItemIds=123
@WorkItemId=123
@Title=Title_in_the_autotest_card
@Description=Test_with_all_annotations
@Tags=Tag1,Tag2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class TagType:
LINKS = 'Links='
TITLE = 'Title='
WORK_ITEM_IDS = 'WorkItemIds='
WORK_ITEM_ID = 'WorkItemId='
DESCRIPTION = 'Description='
LABELS = 'Labels='
TAGS = 'Tags='
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,13 @@ def parse_scenario(scenario):
if TagType.CLASSNAME in tags:
executable_test['classname'] = tags[TagType.CLASSNAME]

if TagType.WORK_ITEM_IDS in tags:
if TagType.WORK_ITEM_IDS in tags and tags[TagType.WORK_ITEM_IDS]:
# TODO: Fix in python-commons to "workItemIds"
executable_test['workItemsID'] = tags[TagType.WORK_ITEM_IDS]

if TagType.WORK_ITEM_ID in tags and tags[TagType.WORK_ITEM_ID]:
executable_test['workItemsID'] = [tags[TagType.WORK_ITEM_ID]]

if TagType.LAYER in tags and tags[TagType.LAYER]:
executable_test['layer'] = tags[TagType.LAYER]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .models.label import get_label_model
from .models.tags import TagType
from .models.url_link import get_url_to_link_model, get_dict_to_link_model
import logging


def parse_test_tags(tags):
Expand All @@ -10,6 +11,7 @@ def parse_test_tags(tags):
TagType.LINKS: [],
TagType.TITLE: None,
TagType.WORK_ITEM_IDS: [],
TagType.WORK_ITEM_ID: None,
TagType.DESCRIPTION: None,
TagType.LABELS: [],
TagType.TAGS: [],
Expand All @@ -32,10 +34,14 @@ def parse_test_tags(tags):
elif TagType.TITLE in tag:
parsed_tags[TagType.TITLE] = __parse_space_in_tag(tag[len(TagType.TITLE):])

elif TagType.WORK_ITEM_IDS in tag:
elif tag.startswith(TagType.WORK_ITEM_IDS):
logging.warning('WorkItemIds is deprecated. Use WorkItemId with a single globalId instead.')
parsed_tags[TagType.WORK_ITEM_IDS].extend(
__parse_massive(tag[len(TagType.WORK_ITEM_IDS):]))

elif tag.startswith(TagType.WORK_ITEM_ID):
parsed_tags[TagType.WORK_ITEM_ID] = __parse_space_in_tag(tag[len(TagType.WORK_ITEM_ID):])

elif TagType.DESCRIPTION in tag:
parsed_tags[TagType.DESCRIPTION] = __parse_space_in_tag(tag[len(TagType.DESCRIPTION):])

Expand Down
8 changes: 5 additions & 3 deletions testit-adapter-nose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ Decorators can be used to specify information about autotest.

Description of decorators:

- `testit.workItemIds` - a method that links autotests with manual tests. Receives the array of manual tests' IDs
- `testit.workItemId` - a method that links an autotest with a manual test. Receives a single globalId
- `testit.workItemIds` - deprecated, use `testit.workItemId` instead
- `testit.displayName` - internal autotest name (used in Test IT)
- `testit.externalId` - unique internal autotest ID (used in Test IT)
- `testit.title` - autotest name specified in the autotest card. If not specified, the name from the displayName method is used
Expand All @@ -111,7 +112,8 @@ All decorators support the use of parameterization attributes

Description of methods:

- `testit.addWorkItemIds` - a dynamic method that links autotests with manual tests. Receives the array of manual tests' IDs
- `testit.addWorkItemId` - a dynamic method that links an autotest with a manual test. Receives a single globalId
- `testit.addWorkItemIds` - deprecated, use `testit.addWorkItemId` instead
- `testit.addDisplayName` - a dynamic method for adding internal autotest name (used in Test IT)
- `testit.addExternalId` - a dynamic method for adding unique internal autotest ID (used in Test IT)
- `testit.addTitle` - a dynamic method for adding autotest name specified in the autotest card. If not specified, the name from the displayName method is used
Expand Down Expand Up @@ -189,7 +191,7 @@ import testit
from nose2.tools import params

@params(1, 2, 3)
@testit.workItemIds(627)
@testit.workItemId(627)
@testit.externalId('param {num}')
@testit.displayName('param {num}')
@testit.title('Test with params')
Expand Down
8 changes: 5 additions & 3 deletions testit-adapter-pytest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ Decorators can be used to specify information about autotest.

Description of decorators:

- `testit.workItemIds` - a method that links autotests with manual tests. Receives the array of manual tests' IDs
- `testit.workItemId` - a method that links an autotest with a manual test. Receives a single globalId
- `testit.workItemIds` - deprecated, use `testit.workItemId` instead
- `testit.displayName` - internal autotest name (used in Test IT)
- `testit.externalId` - unique internal autotest ID (used in Test IT)
- `testit.title` - autotest name specified in the autotest card. If not specified, the name from the displayName method is used
Expand All @@ -123,7 +124,8 @@ All decorators support the use of parameterization attributes

Description of methods:

- `testit.addWorkItemIds` - a dynamic method that links autotests with manual tests. Receives the array of manual tests' IDs
- `testit.addWorkItemId` - a dynamic method that links an autotest with a manual test. Receives a single globalId
- `testit.addWorkItemIds` - deprecated, use `testit.addWorkItemId` instead
- `testit.addDisplayName` - a dynamic method for adding internal autotest name (used in Test IT)
- `testit.addExternalId` - a dynamic method for adding unique internal autotest ID (used in Test IT)
- `testit.addTitle` - a dynamic method for adding autotest name specified in the autotest card. If not specified, the name from the displayName method is used
Expand Down Expand Up @@ -220,7 +222,7 @@ import pytest
import testit


@testit.workItemIds(627)
@testit.workItemId(627)
@testit.displayName('Simple autotest 1 - {name}')
@testit.externalId('Simple_autotest1_{name}')
@testit.title('Authorization')
Expand Down
3 changes: 2 additions & 1 deletion testit-adapter-robotframework/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ Description of scenario methods:
- `Add Message` - information about autotest in the autotest result

Description of methods:
- `testit.addWorkItemIds` - a dynamic method that links autotests with manual tests. Receives the array of manual tests' IDs
- `testit.addWorkItemId` - a dynamic method that links an autotest with a manual test. Receives a single globalId
- `testit.addWorkItemIds` - deprecated, use `testit.addWorkItemId` instead
- `testit.addDisplayName` - a dynamic method for adding internal autotest name (used in Test IT)
- `testit.addExternalId` - a dynamic method for adding unique internal autotest ID (used in Test IT)
- `testit.addTitle` - a dynamic method for adding autotest name specified in the autotest card. If not specified, the name from the displayName method is used
Expand Down
4 changes: 4 additions & 0 deletions testit-python-commons/src/testit.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
nameSpace,
title,
workItemID,
workItemId,
workItemIds
)
from testit_python_commons.dynamic_methods import (
addAttachments,
addLink,
addLinks,
addMessage,
addWorkItemId,
addWorkItemIds,
addDisplayName,
addNameSpace,
Expand All @@ -43,6 +45,7 @@
'nameSpace',
'className',
'workItemID',
'workItemId',
'workItemIds',
'title',
'description',
Expand All @@ -57,6 +60,7 @@
'addAttachments',
'message',
'addMessage',
'addWorkItemId',
'addWorkItemIds',
'addDisplayName',
'addNameSpace',
Expand Down
15 changes: 14 additions & 1 deletion testit-python-commons/src/testit_python_commons/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async def async_wrapper(*args, **kwargs):
return function


@Utils.deprecated('Use "workItemIds" instead.')
@Utils.deprecated('Use "workItemId" instead.')
@adapter_logger
def workItemID(*test_workitems_id: int or str): # noqa: N802
def outer(function):
Expand All @@ -49,6 +49,19 @@ def outer(function):
return outer


@adapter_logger
def workItemId(globalId: int or str): # noqa: N802
"""
specifies a method that links an autotest with a manual test. Receives a single globalId
"""
def outer(function):
function.test_workitems_id = [str(globalId)]
return inner(function)

return outer


@Utils.deprecated('Use "workItemId" instead.')
@adapter_logger
def workItemIds(*test_workitems_id: int or str): # noqa: N802
"""
Expand Down
12 changes: 12 additions & 0 deletions testit-python-commons/src/testit_python_commons/dynamic_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def __add_attachments_to_test(data, is_text: bool = False, name: str = None):
logging.warning(f'({data}) is not path!')


@Utils.deprecated('Use "addWorkItemId" instead.')
@adapter_logger
def addWorkItemIds(*test_work_item_ids: int or str): # noqa: N802
"""
Expand All @@ -142,6 +143,17 @@ def addWorkItemIds(*test_work_item_ids: int or str): # noqa: N802
TmsPluginManager.get_plugin_manager().hook.add_work_item_id(test_work_item_id=str(test_work_item_id))


@adapter_logger
def addWorkItemId(globalId: int or str): # noqa: N802
"""
a dynamic method that links an autotest with a manual test. Receives a single globalId
"""
if not hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_work_item_id'):
return

TmsPluginManager.get_plugin_manager().hook.add_work_item_id(test_work_item_id=str(globalId))


@adapter_logger
def addDisplayName(test_display_name: str): # noqa: N802
"""
Expand Down
Loading