Mantis Bugtracker          
testlink.org

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007609TestLinkExport/Importpublic2016-06-23 13:592016-09-08 15:12
ReporterMr.Bricodage 
Assigned Tofman 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version1.9.14 (2015 Q3) 
Fixed in Version1.9.15 (2015 Q4) 
Summary0007609: Unable to update existant testcase data from XML file if detection is done with External ID containing prefix
DescriptionDuring import, Testlink display an error if option "Consider Test Case as duplicate if has same External ID" and "Update data on last version" are set.

External ID format provided in xml file (and compliant with testlink, because just exported from it, see steps to reproduce) is not handled by testlink during import.

Steps To Reproduce1 - Export testcases from testlink, check option "With Test Case prefix"
2 - On import page,
2.1 - point to the file downloaded in step 1
2.2 - set "Consider Test Case as duplicate if" to the value "Has same external ID"
2.3 - set "Action for duplicates" to the value "Update data on last version"
2.4 - submit

TestLink display a error page :
 ==============================================================================

 DB Access Error - debug_print_backtrace() OUTPUT START

 ATTENTION: Enabling more debug info will produce path disclosure weakness (CWE-200)

            Having this additional Information could be useful for reporting

            issue to development TEAM.

 ==============================================================================

#0 database->exec_query(/* Class:testcase - Method: get_by_external */ SELECT DISTINCT NH_TCASE.id,NH_TCASE.name,NH_TCASE_PARENT.id AS parent_id, NH_TCASE_PARENT.name AS tsuite_name, TCV.tc_external_id FROM nodes_hierarchy NH_TCASE, nodes_hierarchy NH_TCASE_PARENT, nodes_hierarchy NH_TCVERSIONS, tcversions TCV WHERE NH_TCVERSIONS.id=TCV.id AND NH_TCVERSIONS.parent_id=NH_TCASE.id AND NH_TCASE_PARENT.id=NH_TCASE.parent_id AND NH_TCASE.node_type_id = 3 AND TCV.tc_external_id= AND NH_TCASE_PARENT.id = 54, -1) called at [D:\Mr.B\GitHub\testlink-code\lib\functions\database.class.php:647]
#1 database->fetchRowsIntoMap(/* Class:testcase - Method: get_by_external */ SELECT DISTINCT NH_TCASE.id,NH_TCASE.name,NH_TCASE_PARENT.id AS parent_id, NH_TCASE_PARENT.name AS tsuite_name, TCV.tc_external_id FROM nodes_hierarchy NH_TCASE, nodes_hierarchy NH_TCASE_PARENT, nodes_hierarchy NH_TCVERSIONS, tcversions TCV WHERE NH_TCVERSIONS.id=TCV.id AND NH_TCVERSIONS.parent_id=NH_TCASE.id AND NH_TCASE_PARENT.id=NH_TCASE.parent_id AND NH_TCASE.node_type_id = 3 AND TCV.tc_external_id= AND NH_TCASE_PARENT.id = 54, id) called at [D:\Mr.B\GitHub\testlink-code\lib\functions\testcase.class.php:5329]
0000002 testcase->get_by_external(, 54) called at [D:\Mr.B\GitHub\testlink-code\lib\testcases\tcImport.php:389]
Additional InformationIn tcImport.php, externalid is defined as integer in getTestCaseSetFromSimpleXMLObj() data structure.

In XML files generated by testlink, externalid is the concatenation of project prefix and externalid (example : proj-123) => cannot be an integer.



TagsNo tags attached.
Database (MySQL,Postgres,etc)any
Browser
PHP Version
TestCaseID
QA Team - Task Workflow StatusREADY FOR TESTING
Attached Files

- Relationships
related to 0006314closedfman Export TestPlan XML with FULL Testcase External ID to permit TO THIRD PARTY TOOL generation of Execution Result XML file 
related to 0006786closedfman Export Test Spec - add option to export external ID WITH PREFIX 

-  Notes
(0025011)
Mr.Bricodage (updater)
2016-06-23 14:04
edited on: 2016-06-23 14:12

IMHO, the prefix information should be set in a global part of the XML file, because prefix cannot be defined for every testcase :

actual XML content (with prefix checked) :

<?xml version="1.0" encoding="UTF-8"?>
<testsuite id="" name="" >
<node_order><![CDATA[]]></node_order>
<details><![CDATA[]]></details>
<testsuite id="53" name="Parent" >
<node_order><![CDATA[0]]></node_order>
<details><![CDATA[Details about the parent test suite]]></details>
<testsuite id="54" name="myTestSuite" >
<node_order><![CDATA[1]]></node_order>
<details><![CDATA[Details about my TestSuite]]></details>

<testcase internalid="55" name="A first TestCase">
    <node_order><![CDATA[1]]></node_order>
    <externalid><![CDATA[proj-1]]></externalid>
    <version><![CDATA[2]]></version>
    <summary><![CDATA[ The summary of the First TestCase]]></summary>
    <preconditions><![CDATA[ ]]></preconditions>
    <execution_type><![CDATA[1]]></execution_type>
    <importance><![CDATA[2]]></importance>
    <estimated_exec_duration></estimated_exec_duration>
    <status>1</status>
    <is_open>1</is_open>
    <active>1</active>
<steps>
[...]


Proposal :

<?xml version="1.0" encoding="UTF-8"?>
<testsuite id="" name="" >
<node_order><![CDATA[]]></node_order>
<details><![CDATA[]]></details>
<prefix><![CDATA[proj]]></prefix>
<testsuite id="53" name="Parent" >
<node_order><![CDATA[0]]></node_order>
<details><![CDATA[Details about the parent test suite]]></details>
<testsuite id="54" name="myTestSuite" >
<node_order><![CDATA[1]]></node_order>
<details><![CDATA[Details about my TestSuite]]></details>

<testcase internalid="55" name="A first TestCase">
    <node_order><![CDATA[1]]></node_order>
    <externalid><![CDATA[1]]></externalid>
    <version><![CDATA[2]]></version>
    <summary><![CDATA[ The summary of the First TestCase]]></summary>
    <preconditions><![CDATA[ ]]></preconditions>
    <execution_type><![CDATA[1]]></execution_type>
    <importance><![CDATA[2]]></importance>
    <estimated_exec_duration></estimated_exec_duration>
    <status>1</status>
    <is_open>1</is_open>
    <active>1</active>
<steps>
[...]


=> new <prefix> tag contains the prefix value
=> externalid is an integer in export => no more problem during import

(0025017)
fman (administrator)
2016-06-25 15:38
edited on: 2016-06-25 16:24

Disagree , xml format will not be changed.
I will work to fix issue

I do not remember why I've added option to add TEST CASE prefix (i'm going to do some searches) but probably has been done to allow integration wit EXTERNAL SYSTEM.
I will add a message to explain users that this option has to be leave uncheked if intention is to import on TestLink

Here the requirement => http://mantis.testlink.org/view.php?id=6786 [^]

(0025020)
Mr.Bricodage (updater)
2016-06-26 09:34

OK, no XML format modification.

What do you think about adding the ability to import into testlink even if prefix has been exported?

Example :
1 - during import, strpos on externalid value to check if (project_prefix . $tlCfg->testcase_cfg->glue_character) is found
2 - if strpos !== false, substr externalid value starting from strpos value and consider that new value is an integer

I can PR on github if solution is OK for you.

With this new ability, the DB access error will occurs only if somebody has changed prefix or glue_character since the export, or if import is done in a wrong project. ==> almost never occurs.
(0025022)
fman (administrator)
2016-06-27 05:43

Hi:

>> What do you think about adding the ability to import into testlink even if prefix has been
>> exported?

I think best thing is doing following minor change:

1) User export requesting test case prefix
<testcase internalid="55" name="A first TestCase">
    <node_order><![CDATA[1]]></node_order>
    <externalid><![CDATA[1]]></externalid>
    <fullexternalid><![CDATA[proj-1]]></fullexternalid>

the new element <fullexternalid> will be ignored on import => no issue.

2) User export WITHOUT requesting test case prefix
<testcase internalid="55" name="A first TestCase">
    <node_order><![CDATA[1]]></node_order>
    <externalid><![CDATA[1]]></externalid>

NEW XML element:
<fullexternalid>
 will NOT BE WRITTEN TO FILE

I will accept this Pull Request if you are willing to develop it

Regards
(0025025)
Mr.Bricodage (updater)
2016-06-27 08:27

Ok, I will push a PR compliant with your last note before the end of the week.
(0025027)
fman (administrator)
2016-06-27 09:13

Great! thanks a lot
(0025048)
Mr.Bricodage (updater)
2016-06-28 22:27

PR : https://github.com/TestLinkOpenSourceTRMS/testlink-code/pull/37 [^]
(0025058)
Mr.Bricodage (updater)
2016-06-30 21:24
edited on: 2016-07-26 08:39

PR merged.
status should be set to resolved, version 1.9.15.

(0025209)
fman (administrator)
2016-09-08 15:12

1.9.15 Released - 2016-09-08

- Issue History
Date Modified Username Field Change
2016-06-23 13:59 Mr.Bricodage New Issue
2016-06-23 14:04 Mr.Bricodage Note Added: 0025011
2016-06-23 14:05 Mr.Bricodage Note Edited: 0025011 View Revisions
2016-06-23 14:08 Mr.Bricodage Relationship added related to 0006314
2016-06-23 14:12 Mr.Bricodage Note Edited: 0025011 View Revisions
2016-06-25 15:38 fman Note Added: 0025017
2016-06-25 16:23 fman Note Edited: 0025017 View Revisions
2016-06-25 16:24 fman Note Edited: 0025017 View Revisions
2016-06-25 16:25 fman Relationship added related to 0006787
2016-06-25 16:26 fman Relationship deleted related to 0006787
2016-06-25 16:26 fman Relationship added related to 0006786
2016-06-25 16:30 fman QA Team - Task Workflow Status => TBD
2016-06-25 16:30 fman Status new => resolved
2016-06-25 16:30 fman Resolution open => won't fix
2016-06-25 16:30 fman Assigned To => fman
2016-06-26 09:34 Mr.Bricodage Note Added: 0025020
2016-06-27 05:43 fman Note Added: 0025022
2016-06-27 05:43 fman Status resolved => feedback
2016-06-27 08:27 Mr.Bricodage Note Added: 0025025
2016-06-27 08:27 Mr.Bricodage Status feedback => assigned
2016-06-27 09:13 fman Note Added: 0025027
2016-06-28 22:27 Mr.Bricodage Note Added: 0025048
2016-06-30 21:24 Mr.Bricodage Note Added: 0025058
2016-06-30 21:25 Mr.Bricodage Note Edited: 0025058 View Revisions
2016-07-26 08:39 Mr.Bricodage Note Edited: 0025058 View Revisions
2016-07-26 13:06 fman QA Team - Task Workflow Status TBD => READY FOR TESTING
2016-07-26 13:06 fman Status assigned => resolved
2016-07-26 13:06 fman Resolution won't fix => fixed
2016-07-26 13:09 Mr.Bricodage Fixed in Version => 1.9.15 (2015 Q4)
2016-09-08 15:12 fman Note Added: 0025209
2016-09-08 15:12 fman Status resolved => closed



Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker