It's all about the answers!

Ask a question

[Closed] How to assign value to attributes in tets case using Excel Importer

Kumar Kumar (6423) | asked Aug 24 '16, 5:53 a.m.
edited Aug 26 '16, 4:13 a.m.
I have an Custom attribute "1. Pre Condition" in Summary block in Test cases.
I need to assign value to it.
I have tried below methods which dint work:

1."1. Pre-Conditions".value=K

2. testcase.Section("","RQM-KEY-TC-PRE-COND-TITLE")=K

Could you tell me the right way to assign values to custom attributes.


Chethan Kumar R

Accepted answer

permanent link
Lily Wang (4.9k714) | answered Aug 25 '16, 2:40 a.m.
  You can refer to about how to get identifier.

To get Custom Attribute Identifier follow below steps : 

  1. Create Custom Attributes for TestCase
  2. Create/Update a TestCase and fill value for the Custom Attributes in the TestCase.
  3. Perform GET of this testcase using RQMURLUtility. In the received xml you should see ns2:customAttributes tag similar to below snippet. The value of "identifier" tag is the Custom Attribute identifier. In this case Identifiers for the 2 Custom Attributes are "Custom_attribute_0_" and "Custom_attribute_1_" respectively
I tested in my 6.0.1 environment, if I created a custom attribute "1. Pre-Conditions", the identifier I got is "_._Pre-Conditions". So in the cfg file it should like:
testcase.customAttributes identifier="_._Pre-Conditions".name="1. Pre-Conditions".type="SMALL_STRING".value=K

Please verify in your environment what the identifier should be.

Kumar Kumar selected this answer as the correct answer

Kumar Kumar commented Aug 25 '16, 3:30 a.m.

Custom attribute "1. Pre-Conditions" is already available in my environment.
Could you please tell me How do i need to read
custom Attributes identifier for existing Custom attribute?

In the mean time tried with
testcase.customAttributes identifier="_._Pre-Conditions".name="1. Pre-Conditions".type="SMALL_STRING".value=K dint work.

One other answer

permanent link
Lily Wang (4.9k714) | answered Aug 25 '16, 1:20 a.m.
For custom attribute, the syntax is:
testcase.customAttributes identifier="<Custom_attribute_identifier>".name="1. Pre-Conditions".type="SMALL_STRING".value=K

Please see about how to get custom attribute identifier.

Kumar Kumar commented Aug 25 '16, 1:38 a.m. | edited Aug 25 '16, 2:10 a.m.

Could you please tell me where to find the "<custom_attribute_identifier>".

I Tried this testcase.customAttributes identifier="1.Pre-Conditions".name="1. Pre-Conditions".type="SMALL_STRING".value=K  but it actually creating a new attribute. :(
Its not created in Custom Attribute section but in Artifact categeries.

Your answer

Register or to post your answer.