I have created an xml file from a csv file with a python script. I have followed the user manual for xml format, and i have created the custom fields and assigned them to the project. However, when i try to import the xml file i get an error: "Value of Custom Field ' CAT ' can not be imported because there is no Custom Field with this name and Available for Test Case on this Test Project"
an example of my xml format:
<custom_field>
<name>
CAT
</name>
<value>
II
</value>
</custom_field>
Thanks for any help you can offer!
No custom field with that name. Importing from xml file
Moderators: Amaradana, TurboPT, TL Developers
Re: No custom field with that name. Importing from xml file
1. is not clear waht you have done => write down here a test case => steps and expected results
2. you can get XML examples from your installation => doc folder.
2. you can get XML examples from your installation => doc folder.
Re: No custom field with that name. Importing from xml file
I am providing the csv document, python script, results from the conversion of csv to xml. The expected result is an xml doc in the format specified by testlink.
Portion of Python script that creates the tests case fields, and then a custom field that i wish to implement:
for line in reader:
if line[0] == "" or line[1] == "" or line[3] == "FALSE" or line[3] == "":
continue
testcase= doc.createElement("testcase")
elem = doc.createElement("summary")
text = doc.createTextNode(line[3])
elem.appendChild(text)
testcase.appendChild(elem)
elem= doc.createElement("steps")
testcase.appendChild(elem)
elem= doc.createElement("expected_results")
testcase.appendChild(elem)
cfields = doc.createElement("custom_fields")
cfield = doc.createElement("custom_field")
elem = doc.createElement("name")
text = doc.createTextNode("CF_PDI")
elem.appendChild(text)
cfield.appendChild(elem)
elem = doc.createElement("value")
text = doc.createTextNode(line[0])
elem.appendChild(text)
cfield.appendChild(elem)
cfields.appendChild(cfield)
Part of the CSV doc:
"GEN000020","II","1.1 Passwords","Automatible"
"GEN000040","II","1.1 Passwords","Manual"
Part of the XML file that is created:
<?xml version="1.0" ?>
<testcases>
<testcase>
<summary>
The IAO and SA will ensure, if configurable, the UNIX host is configured to require a password for access to single-user and maintenance modes.
</summary>
<steps/>
<expected_results/>
<custom_fields>
<custom_field>
<name>
CF_PDI
</name>
<value>
GEN000020
</value>
</custom_field>
<custom_field>
<name>
CAT
</name>
<value>
II
</value>
</custom_field>
<custom_field>
<name>
Title
</name>
<value>
2.5.1.1 System Equipment
</value>
</custom_field>
</custom_fields>
</testcase>
Portion of Python script that creates the tests case fields, and then a custom field that i wish to implement:
for line in reader:
if line[0] == "" or line[1] == "" or line[3] == "FALSE" or line[3] == "":
continue
testcase= doc.createElement("testcase")
elem = doc.createElement("summary")
text = doc.createTextNode(line[3])
elem.appendChild(text)
testcase.appendChild(elem)
elem= doc.createElement("steps")
testcase.appendChild(elem)
elem= doc.createElement("expected_results")
testcase.appendChild(elem)
cfields = doc.createElement("custom_fields")
cfield = doc.createElement("custom_field")
elem = doc.createElement("name")
text = doc.createTextNode("CF_PDI")
elem.appendChild(text)
cfield.appendChild(elem)
elem = doc.createElement("value")
text = doc.createTextNode(line[0])
elem.appendChild(text)
cfield.appendChild(elem)
cfields.appendChild(cfield)
Part of the CSV doc:
"GEN000020","II","1.1 Passwords","Automatible"
"GEN000040","II","1.1 Passwords","Manual"
Part of the XML file that is created:
<?xml version="1.0" ?>
<testcases>
<testcase>
<summary>
The IAO and SA will ensure, if configurable, the UNIX host is configured to require a password for access to single-user and maintenance modes.
</summary>
<steps/>
<expected_results/>
<custom_fields>
<custom_field>
<name>
CF_PDI
</name>
<value>
GEN000020
</value>
</custom_field>
<custom_field>
<name>
CAT
</name>
<value>
II
</value>
</custom_field>
<custom_field>
<name>
Title
</name>
<value>
2.5.1.1 System Equipment
</value>
</custom_field>
</custom_fields>
</testcase>