All executions lost when removing the last TC version

LATEST Official version.
Questions and discussions - NO ISSUES
FOR ISSUES => http://mantis.testlink.org

Moderators: Amaradana, TurboPT, TL Developers

Post Reply
atisne
TestLink user
Posts: 9
Joined: Tue Jun 17, 2014 6:40 pm

All executions lost when removing the last TC version

Post by atisne »

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?
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: All executions lost when removing the last TC version

Post by fman »

mmm, I'm going to check.
I'm sorry for the issue

as you know for this kind of things it's better if you open an issue on mantis.testlink.org
atisne
TestLink user
Posts: 9
Joined: Tue Jun 17, 2014 6:40 pm

Re: All executions lost when removing the last TC version

Post by atisne »

Hi Francisco. Thanks for your answer.
I've first posted here because I was not sure if this behavior was wanted or not.
I opened the issue http://mantis.testlink.org/view.php?id=9121 to investigate.
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: All executions lost when removing the last TC version

Post by fman »

Thanks a lot
I've started the refactoring, and I'm near to close the tests.
We will update via mantis

have a nice day
Post Reply