Skip to content

Commit 48a33a7

Browse files
committed
For Issue Tracker integration use Product/Version from execution.build
similar to previous commits use Product/Version values based on the Build a specific TestExecution status was recorded against instead of using values coming from TestRun->TestPlan which can change in the future. NOTE: execution.build is initialized with run.build and then may change its value if we're recording results against multiple builds inside the same TestRun. (For example mark some executions as PASS, others as FAIL; then update TR to a newer Build; retest and mark the FAIL results as PASS)
1 parent 5ef7ed2 commit 48a33a7

13 files changed

+30
-21
lines changed

tcms/issuetracker/base.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,17 @@ def _report_comment(self, execution, user=None): # pylint: disable=no-self-use
9090
{reporter}
9191
9292
**Product:**
93-
{execution.run.plan.product.name}
93+
{execution.build.version.product.name}
9494
95-
**Component(s):**
96-
{self.get_case_components(execution.case)}
95+
**Version:**
96+
{execution.build.version.value}
9797
98-
**Version-Release number** (if applicable):
98+
**Build:**
9999
{execution.build.name}
100100
101+
**Component(s):**
102+
{self.get_case_components(execution.case)}
103+
101104
**Steps to reproduce**:
102105
{txt}
103106

tcms/issuetracker/bugzilla_integration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ def _report_issue(self, execution, user):
7878
to a URL with some of the values pre-defined as query parameters!
7979
"""
8080
args = {
81-
"product": execution.run.plan.product.name,
81+
"product": execution.build.version.product.name,
8282
"component": self.get_case_components(execution.case),
83-
"version": execution.run.plan.product_version.value,
83+
"version": execution.build.version.value,
8484
"short_desc": f"Test case failure: {execution.case.summary}",
8585
"comment": self._report_comment(execution, user),
8686
}

tcms/issuetracker/kiwitcms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ def _report_issue(self, execution, user):
6969
data = {
7070
"reporter": user,
7171
"summary": f"Failed test: {execution.case.summary}",
72-
"product": execution.run.plan.product,
73-
"version": execution.run.plan.product_version,
72+
"product": execution.build.version.product,
73+
"version": execution.build.version,
7474
"build": execution.build,
7575
"text": self._report_comment(execution, user),
7676
"_execution": execution,

tcms/issuetracker/tests/test_azureboards.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def test_report_issue_from_test_execution_1click_works(self):
122122
for expected_string in [
123123
f"Filed from execution {self.execution_1.get_full_url()}",
124124
"Reporter",
125-
self.execution_1.run.plan.product.name,
125+
self.execution_1.build.version.product.name,
126126
self.component.name,
127127
"Steps to reproduce",
128128
self.execution_1.case.text,

tcms/issuetracker/tests/test_bitbucket.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def test_report_issue_from_test_execution_1click_works(self):
111111
for expected_string in [
112112
f"Filed from execution {self.execution_1.get_full_url()}",
113113
"Reporter",
114-
self.execution_1.run.plan.product.name,
114+
self.execution_1.build.version.product.name,
115115
self.component.name,
116116
"Steps to reproduce",
117117
self.execution_1.case.text,

tcms/issuetracker/tests/test_bugzilla.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ def test_report_issue_from_test_execution_falls_back_to_query_params(self):
105105
test_case.save() # will generate history object
106106

107107
test_run = TestRunFactory(plan=test_plan)
108+
test_run.build.version = version
109+
test_run.build.save()
110+
108111
execution2 = TestExecutionFactory(
109112
run=test_run, case=test_case, build=test_run.build
110113
)
@@ -144,6 +147,9 @@ def test_report_issue_from_test_execution_1click_works(self):
144147
test_case.save() # will generate history object
145148

146149
test_run = TestRunFactory(plan=test_plan)
150+
test_run.build.version = version
151+
test_run.build.save()
152+
147153
execution2 = TestExecutionFactory(
148154
run=test_run, case=test_case, build=test_run.build
149155
)

tcms/issuetracker/tests/test_github.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def test_report_issue_from_test_execution_1click_works(self):
151151
for expected_string in [
152152
f"Filed from execution {self.execution_1.get_full_url()}",
153153
"Reporter",
154-
self.execution_1.run.plan.product.name,
154+
self.execution_1.build.version.product.name,
155155
self.component.name,
156156
"Steps to reproduce",
157157
self.execution_1.case.text,

tcms/issuetracker/tests/test_gitlab_com.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def test_report_issue_from_test_execution_1click_works(self):
136136
for expected_string in [
137137
f"Filed from execution {self.execution_1.get_full_url()}",
138138
"Reporter",
139-
self.execution_1.run.plan.product.name,
139+
self.execution_1.build.version.product.name,
140140
self.component.name,
141141
"Steps to reproduce",
142142
self.execution_1.case.text,

tcms/issuetracker/tests/test_gitlab_ee.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def test_report_issue_from_test_execution_1click_works(self):
175175
for expected_string in [
176176
f"Filed from execution {self.execution_1.get_full_url()}",
177177
"Reporter",
178-
self.execution_1.run.plan.product.name,
178+
self.execution_1.build.version.product.name,
179179
self.component.name,
180180
"Steps to reproduce",
181181
self.execution_1.case.text,

tcms/issuetracker/tests/test_jira.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ def _fixture_setup(self):
3434
self.execution_1.run.save()
3535

3636
# this is the name of the Project in JIRA. Key is "KT"
37-
self.execution_1.run.plan.product.name = "Kiwi TCMS"
38-
self.execution_1.run.plan.product.save()
37+
self.execution_1.build.version.product.name = "Kiwi TCMS"
38+
self.execution_1.build.version.product.save()
3939

4040
self.component = ComponentFactory(
4141
name="JIRA integration", product=self.execution_1.run.plan.product
@@ -129,7 +129,7 @@ def test_report_issue_from_test_execution_1click_works(self):
129129
for expected_string in [
130130
f"Filed from execution {self.execution_1.get_full_url()}",
131131
"Reporter",
132-
self.execution_1.run.plan.product.name,
132+
self.execution_1.build.version.product.name,
133133
self.component.name,
134134
"Steps to reproduce",
135135
self.execution_1.case.text,

0 commit comments

Comments
 (0)