Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

Moving/copying test cases between projects


#1

It seems that there is no way to move/copy test cases between projects properly.

The API for get_case doesn’t even respond with precondition or step information, let alone attachments.

I tried exporting the test cases in XML and re-importing to the new project. While images embedded in the steps continued to work (as they were pointing to a global resource), the XML did not contain information about attachments.

Is this latter problem going to be looked at at some stage?

Thanks
Martin


#2

Hi,

I just used the copy/move option from within one of my test suites which copied a section of another projects test cases (inside a suite) to it without an issue. It does work. It kind of works backwards from the way I figured it out (copy from existing suite while in it to a new projects suite).

I can’t help you with attachments and the XML part. I have gone down the XML path in the past and that seemed to work fine. I’m running 4.x.x.x version (latest) on their servers.

Mike


#3

Hi @msoucy,

Many thanks for the response. I hadn’t even noticed the copy / move icon even though I was looking directly in that area (maybe a case of domestic blindness, maybe the icon could be more obvious?).

Also, without your tip on the reverse conceptualisation, I think I might have been knocking my head against the desk. It’s great once you “get it”.

I think that the XML export thing should still be fixed though. I no longer need it for this purpose but it’s definitely not working and someone might need it for something else in the future.

Thanks
Martin


#4

Hello Martin,

Thanks for your posting. You can copy/move test cases between projects using the Copy/Move Test Cases dialog on the suite/cases pages (the icon with two sheets of paper). This looks as follows:

(very similar to the Select Cases dialog for runs/plans)

Please note that moving test cases also removes related test results in active test runs/plans.

Regarding the XML exports: Attachments are currently not included in the XML exports but it’s planned to look into this (and we already had this on our todo list).

Regarding the API: get_case/get_cases return all test case details and this also includes custom fields such as Preconditions or Steps. Could you please check if the fields were assigned to the project you tested this with? The custom fields are returned with their system name, prefixed with ‘custom_’ (for example, ‘custom_preconds’):

http://docs.gurock.com/testrail-api2/reference-cases#get_case

(please see Response Content for an example)

Regards,
Tobias


#5

Hi Tobias,

Regarding the API, apologies, I did not realise that pre-conditions and steps were custom fields.

Even now that I can see that it is possible to treat them as custom, I am surprised that this is the case. I am assuming that there is a use case for this even if I can’t figure what it is.

Nevertheless, attachments is not a custom field or a system field, so it is not included in the API either.

Looking forward to those changes you mentioned for both API and XML.

Thanks
Martin


#6

Hello Martin,

Thanks for your reply. Preconditions and Steps are implemented as custom fields because this is only one way of using TestRail. It would also be possible to use a more structured approach with the separated steps field, for example:

http://docs.gurock.com/testrail-faq/config-steps

In this case, it would be useful to remove the default Preconditions and Steps fields, for example.

Attachment support for the API is planned and is already on our feature request list. Thanks again for your feedback on this!

Regards,
Tobias


#7

Tobias: I am trying to copy a test case from one project to another, but clicking on the copy icon is NOT bringing up the page you show, even after I pick the source. Instead, I just get instructions on how to copy a testcase within a suite, which I already know how to do.

Did something change about copying files to another project? Could you please provide more explicit how-to details?


#8

Hi!

The Copy/Move Cases dialog is only for copying/moving cases across suites and/or projects. To do this, you would go to the target suite/project, open this dialog and then choose the source suite/project. To copy cases within the same suite/case repository, you can simply use drag & drop instead.

I hope this helps!

Cheers,
Tobias


#9

Hi,

When we copy / move test cases between projects, all the screenshots embedded in a test case step are lost in the new project. Any suggestions on how we can recover these or is this on the cards for an upcoming releases?


#10

Hello Pratik,

Thank you for the post. When copying or moving test cases between projects, your images should be retained. What process are you going through the copy / move your test cases?


#11

I was able to find the exact scenario when images aren’t retained. It seems like if there are images embedded to the Test Notes section of a test case, these are not retained when such tests are copied / moved to a different project.
This problem seems isolated to images embedded in the Test Notes section.


#12

Hi Pratik,

Thanks for your reply! The ‘Test Notes’ sections sounds like it might be a custom field you have configured on your instance. Are you sure that the Test Notes field is enabled on the new project that you’re copying test cases too? You can verify this under Administration > Customizations (just edit the field and see the project selection to be sure). Hope this helps!

Regards,
Marco


#13

Hi, i still have a problem with moving test cases to another suites. I select cases for moving, press " move " button.
And I see the window where I should able select the cases for moving, but test cases is absent. Please, look on link below https://prnt.sc/h85cst

TestRail v5.4.0.3659