2

I have the xUnitFileImport scheduled job configured in my polarion project (as described in Polarion documentation) to import e2e test results (formatted to JUnit test results)

  <job cronExpression="0 0/5 * * * ? *" id="xUnitFileImport" name="Import e2e Tests Results" scope="system">
    <path>D:\myProject\data\import-test-results\e2e-gitlab</path>
    <project>myProject</project>
    <userAccountVaultKey>myKey</userAccountVaultKey>
    <maxCreatedDefects>10</maxCreatedDefects>
    <maxCreatedDefectsPercent>5</maxCreatedDefectsPercent>
    <templateTestRunId>xUnit Build Test</templateTestRunId>
    <idRegex>(.*).xml</idRegex>
    <groupIdRegex>(.*)_.*.xml</groupIdRegex>
  </job>

This works and I get my test results imported into a new test run and new test cases are created. But if I run the import job multiple times (for each test run) it creates duplicate test case work items even though they have the same name, which leads to this situation:

duplicate test cases created

Is there some way to tell the import job to reference the existing testcases to the newly created test run, instead of creating new ones?




What i have done so far:

  • yes I checked that the "custom field for test case id" in the "testing > configuration" is configured
  • yes I checked that the field value is really set in the created test case
  • The current value in this field is e.g. ".Login" as i don't want the classnames in the report. enter image description here
  • YES I still get the same behaviour with the classname set
  • In the scheduler I have changed the job parameter for the group id because it wasn't filled. New value is: <groupIdRegex>e2e-results-(.*).xml</groupIdRegex>
  • I checked that no other custom fields are interfering, only the standard fields are set enter image description here
  • I checked that no readonly fields are present
  • I do use a template for the testcases as supported by the xUnitFileImport. The testcases are successfully created and i don't see anything that would interfere
  • However I do have a hyperlink set in the template (I'll try removing this soon™)
  • I changed the test run template from "xUnit Build test" to "xUnit Manual Test Upload" this however did not lead to any visible change
  • I changed the template status from draft to active. Had no change in behaviour.
  • I tripple checked all the fields in the created test cases. They are literally the same, which leads to the conclusion that no fields in the testcases interfere with referencing to them



After all this time i have invested now, researching on my own and asking on different forums, I am ready to call this a polarion bug unless someone proves me this functionality is working.

Nikita Meier
  • 167
  • 1
  • 10

1 Answers1

2

I believe you have to set a custom field that identifies the testcase with the xUnit file you're importing, for the importer to identify the testcase. Try adding a custom field to the TestCase workitem and selecting it here.

Custom Field for Test Case ID option in settings

If you're planning on creating test cases beforehand, note that the ID is formatted form the {classname}.{name} for a given case.

  • I just checked my configuration. I already had the "Custom Field for Test Case ID" set. And it is saved inside test cases created by the importer. E.g. ".Workplace selection", I currently have the {classname} empty but i get the same result with it set. So this doesn't seem to to stop duplicate Test Cases from being created... – Nikita Meier Mar 02 '22 at 07:42
  • Can't think of any other reason for such behaviour... The documentation specifies, this is the field for test case matching. I would check all other settings that might've been modified from the default (i.e. testcase workitem - readonly field etc., test templates) – Miha Meglic Mar 07 '22 at 09:40