Here is what we are tying to do:
Create a new test via REST API with test type as Automated[Generic] and making sure the test definition field is populated as required(classpath+'.'+class name). Let's assume the test key for this test is MYPROJ-999.
We run the automated test and generate Junit xml report.xml for the same test which was created in #1.
We post the result using REST API.
curl -H "Content-Type: multipart/form-data" -u user:pwd -F "file=@report.xml" https://jira.my.com/rest/raven/1.0/import/execution/junit?projectKey=MYPROJ
Expected Result:
The result for MYPROJ-999 should be updated with PASS/FAILED and a new Test Execution issue should be created. No new test should be created.
Actual Result:
The API is creating a new test instead of updating the existing test MYPROJ-99.
Interesting observation is, if we create the test using Jira UI instead of using REST API, it works fine. No duplicate test is created.
As far as we can tell, the test created via UI and the test created via REST API, they look exactly the same. So, we are not able to understand, why the test created via API is behaving differently.