Skip to content

Commit

Permalink
Fix broken import and minor bug with converting status2id
Browse files Browse the repository at this point in the history
Change-Id: I5ae8c04f233e97f2386eeba821fecb7cc0b66b9a
  • Loading branch information
ibumarskov committed Nov 14, 2019
1 parent 5ddf381 commit a784d39
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Before use the script set TestRail parameters:
-s TR_SUITE TestRail Suite name.
-m TR_MILESTONE TestRail milestone.
-c TR_CONF Set configuration for test entry (Test Run). Example:
-c "{'Contrail':'OC 4.1'}"
-c "{'Operating Systems':'Ubuntu 18.04'}"
--remove-untested Remove untested cases from Test Run
--result-attrs TR_RESULT_ATTRS
Custom result attributes
Expand Down Expand Up @@ -125,13 +125,13 @@ This template is used for convert name of custom attribute to id.

Example of template: *etc/attrs2id.yaml*

### Actions for string generation (actions)
### Actions for string generation

- *custom-map* - contains list of dictionaries. Checks if test case match dict.value (re.search() is used) and return dict.key as name.
- *find* - get first element found by re.findall() function.
- *replace* - replaces all occurrences of found substrings.

### Actions for string generation from xml file (xml_actions)
### Actions for string generation from xml file

XML actions are used to generate string from XML file. All actions are performed in the order specified in template.

Expand All @@ -154,7 +154,7 @@ To run testrail_reporter against TestRail using docker image:
1. Pull docker image from [dockerhub](https://hub.docker.com/r/bumarskov/testrail_reporter)
`docker push bumarskov/testrail_reporter:<tagname>`
2. Run qa_report.py script to upload test results:
`docker run -v '<path_to_results>:/tmp/result.xml' -e $TESTRAIL_URL="<url>" -e $TESTRAIL_USER="<user>" -e $TESTRAIL_PASSWORD="<password>" testrail_reporter:<tagname> python reporter.py publish /tmp/<results_file> -p "<TestRail project>" -t "<TestRail test plan>" -r "<TestRail test run>" -s "<TestRail suite>" -c`
`docker run -v '<path_to_results>:/tmp/report.xml' -e TESTRAIL_URL="<url>" -e TESTRAIL_USER="<user>" -e TESTRAIL_PASSWORD="<password>" testrail-reporter:<tagname> python reporter.py publish /tmp/report.xml -p "<TestRail project>" -t "<TestRail test plan>" -r "<TestRail test run>" -s "<TestRail suite>" -c "<Configuration>" --remove-untested`

### How to build docker image
Before build docker image from local copy of repository remove all `.*pyc` files and `__pycache__` folder:
Expand Down
2 changes: 1 addition & 1 deletion lib/testrailreporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def convert_customfield2id(self, tc, field_name):

def _convert_status2id(self, result):
for s in self.project.statuses:
if result['status_id'] == s['name']:
if result['status_id'].lower() == s['label'].lower():
result['status_id'] = s['id']
return True
raise Exception("Can't find status: {}".format(result['status_id']))
Expand Down
5 changes: 2 additions & 3 deletions reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
import json

from lib.config import Config
from lib.reportparser import CheckListParser
from lib.settings import TRR_LOG_FILE, TRR_LOG_LEVEL
from lib.reportparser import ReportParser
from lib.testcaseparser import TestCaseParser
from lib.testrailanalyzer import TestRailAnalyzer
from lib.testrailanalyzer import CheckListParser, TestRailAnalyzer
from lib.testrailproject import TestRailProject
from lib.testrailreporter import TestRailReporter

Expand Down Expand Up @@ -138,7 +137,7 @@ def main():
parser_b.add_argument(
'-c', dest='tr_conf', default=None,
help="Set configuration for test entry (Test Run). "
"Example: -c \"{'Contrail':'OC 4.1'}\""
"Example: -c \"{'Operating Systems':'Ubuntu 18.04'}\""
)
parser_b.add_argument(
'--remove-untested', dest='remove_untested', action="store_true",
Expand Down

0 comments on commit a784d39

Please sign in to comment.