All executions lost when removing the last TC version
Posted: Tue Aug 10, 2021 3:55 pm
Hi,
Removing the last execution of a test case in a plan test results to lost all previous executions.
Steps (with a project leader):
1- attach a TC to a TP
2- execute the TC
3- execute the same TC twice (optional)
4- create a new version of TC
5- execute TC
5.1- update the link to the latest version (2)
5.2- execute TC
6- Remove the (last) version (2) of TC
Analyzing the code, we found it's due to the fact that all existing executions are updated at the step 5.1.
Let's see the DB.
At step 3, we have 2 executions linked to TCV 5
select * from executions;
id | build_id | tester_id | execution_ts | status | testplan_id | tcversion_id | tcversion_number | platform_id | execution_type | execution_duration | notes
----+----------+-----------+---------------------+--------+-------------+--------------+------------------+-------------+----------------+--------------------+-------
1 | 1 | 2 | 2021-08-10 17:19:07 | p | 21 | 5 | 1 | 0 | 1 | |
2 | 1 | 2 | 2021-08-10 17:19:12 | p | 21 | 5 | 1 | 0 | 1 | |
(2 rows)
At step 5.1 (update the TC version linked to the TP), we can notice all the existing executions are linked to the latest TC version (id 22, that is not version number 1!)
select * from executions;
id | build_id | tester_id | execution_ts | status | testplan_id | tcversion_id | tcversion_number | platform_id | execution_type | execution_duration | notes
----+----------+-----------+---------------------+--------+-------------+--------------+------------------+-------------+----------------+--------------------+-------
2 | 1 | 2 | 2021-08-10 17:27:59 | p | 21 | 22 | 1 | 0 | 1 | |
1 | 1 | 2 | 2021-08-10 17:27:52 | p | 21 | 22 | 1 | 0 | 1 | |
(2 rows)
At step 5.2, we have 3 executions
select * from executions;
id | build_id | tester_id | execution_ts | status | testplan_id | tcversion_id | tcversion_number | platform_id | execution_type | execution_duration | notes
----+----------+-----------+---------------------+--------+-------------+--------------+------------------+-------------+----------------+--------------------+-------
2 | 1 | 2 | 2021-08-10 17:27:59 | p | 21 | 22 | 1 | 0 | 1 | |
1 | 1 | 2 | 2021-08-10 17:27:52 | p | 21 | 22 | 1 | 0 | 1 | |
3 | 1 | 2 | 2021-08-10 17:32:06 | p | 21 | 22 | 2 | 0 | 1 | |
(3 rows)
At step 6 (after removing the version), we have no more executions
select * from executions;
id | build_id | tester_id | execution_ts | status | testplan_id | tcversion_id | tcversion_number | platform_id | execution_type | execution_duration | notes
----+----------+-----------+--------------+--------+-------------+--------------+------------------+-------------+----------------+--------------------+-------
(0 rows)
I wonder why we couldn't keep previous executions? Removing the last version do not invalidate the execution history of the previous versions.
More accurately, I wonder why updated all the executions when we update the link to the last version (step 5.1)?
https://github.com/TestLinkOpenSourceTR ... .php#L9032
If we don't update executions (and probably also custom fields executions values), things looks good. We retrieve the execution history after re-attaching the last version to the test plan.
Did I missed something?
Removing the last execution of a test case in a plan test results to lost all previous executions.
Steps (with a project leader):
1- attach a TC to a TP
2- execute the TC
3- execute the same TC twice (optional)
4- create a new version of TC
5- execute TC
5.1- update the link to the latest version (2)
5.2- execute TC
6- Remove the (last) version (2) of TC
Analyzing the code, we found it's due to the fact that all existing executions are updated at the step 5.1.
Let's see the DB.
At step 3, we have 2 executions linked to TCV 5
select * from executions;
id | build_id | tester_id | execution_ts | status | testplan_id | tcversion_id | tcversion_number | platform_id | execution_type | execution_duration | notes
----+----------+-----------+---------------------+--------+-------------+--------------+------------------+-------------+----------------+--------------------+-------
1 | 1 | 2 | 2021-08-10 17:19:07 | p | 21 | 5 | 1 | 0 | 1 | |
2 | 1 | 2 | 2021-08-10 17:19:12 | p | 21 | 5 | 1 | 0 | 1 | |
(2 rows)
At step 5.1 (update the TC version linked to the TP), we can notice all the existing executions are linked to the latest TC version (id 22, that is not version number 1!)
select * from executions;
id | build_id | tester_id | execution_ts | status | testplan_id | tcversion_id | tcversion_number | platform_id | execution_type | execution_duration | notes
----+----------+-----------+---------------------+--------+-------------+--------------+------------------+-------------+----------------+--------------------+-------
2 | 1 | 2 | 2021-08-10 17:27:59 | p | 21 | 22 | 1 | 0 | 1 | |
1 | 1 | 2 | 2021-08-10 17:27:52 | p | 21 | 22 | 1 | 0 | 1 | |
(2 rows)
At step 5.2, we have 3 executions
select * from executions;
id | build_id | tester_id | execution_ts | status | testplan_id | tcversion_id | tcversion_number | platform_id | execution_type | execution_duration | notes
----+----------+-----------+---------------------+--------+-------------+--------------+------------------+-------------+----------------+--------------------+-------
2 | 1 | 2 | 2021-08-10 17:27:59 | p | 21 | 22 | 1 | 0 | 1 | |
1 | 1 | 2 | 2021-08-10 17:27:52 | p | 21 | 22 | 1 | 0 | 1 | |
3 | 1 | 2 | 2021-08-10 17:32:06 | p | 21 | 22 | 2 | 0 | 1 | |
(3 rows)
At step 6 (after removing the version), we have no more executions
select * from executions;
id | build_id | tester_id | execution_ts | status | testplan_id | tcversion_id | tcversion_number | platform_id | execution_type | execution_duration | notes
----+----------+-----------+--------------+--------+-------------+--------------+------------------+-------------+----------------+--------------------+-------
(0 rows)
I wonder why we couldn't keep previous executions? Removing the last version do not invalidate the execution history of the previous versions.
More accurately, I wonder why updated all the executions when we update the link to the last version (step 5.1)?
https://github.com/TestLinkOpenSourceTR ... .php#L9032
If we don't update executions (and probably also custom fields executions values), things looks good. We retrieve the execution history after re-attaching the last version to the test plan.
Did I missed something?