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

How do I import test cases from CSV file with sections and subsections


#1

I understand that I can only import a single suite of test cases in one import. However, I have been unable to figure out how to import a complex set of test cases (i.e. having multiple sections and subsections). I see examples of how to do this in the XML import but the subsection field is not in the mapping tool when you import a .csv file.

My export file has the following structure
ID, Section, Subsection, Title

Is it possible to do this and, if so, how do you define the mapping.

Thanks


#2

Hello Bruce,

Thanks for your posting. The CSV import can also import complex section hierarchies and supports this by using ‘>’ as part of the section field. For example, if you have the following values for the section column in your CSV file:

Section 1 Section 1 > Section 1.1 Section 2 Section 2 > Section 2.1 > Section 2.1.1

TestRail would automatically create the following hierarchy for this and add the test cases to the correct section:

[list=]
[
]Section 1
[list=]
[
]Section 1.1[/]
[/list][/
]
[]Section 2
[list=
]
[]Section 2.1
[list=
]
[]Section 2.1.1[/]
[/list][/]
[/list][/
]
[/list]

In order to implement this with your particular CSV layout, you would need to merge the Section and Subsection columns into a single Section column with the ‘>’ separator. So, if you have the following layout:

"Section","Subsection" Section 1, Section 1.1

You would need to change this to:

"Section","Subsection" Section 1 > Section 1.1, (can be left empty)

Would this work for you?

Regards,
Tobias


#3

Hi,
I exported a suite from TestRail, then tried to import back to a different project (just want to try). Nice to confirm myself that importing with section/subsection info is working :slight_smile:
Not sure if there is anything else, but one thing I noticed is that, the separate test steps and step test results are not imported back in in the correct format (ie. not using the expected steps format). Is this because of the export process (test steps and step results are exported to one row instead of multiple rows), or did I not configure the import as expected by TestRail?

How to import test steps and step results?

Thanks,

Vincent Nguyen.


#4

Hi Vincent,

The CSV export format doesn’t currently list the separate steps in separate rows so the import feature wouldn’t be able to load this correctly. The workflow of exporting/importing CSV files is also not really useful as we have a much better/more structured XML format that would support this (e.g. to move test cases between TestRail instances). The CSV import/export feature is mainly designed for interoperability with other systems to e.g. migrate existing test cases to TestRail.


#5

I am unable to see the .csv import option. What could be the problem?


#6

Hi @hameetha,

The CSV import functionality is available on the case repository/suite pages:

http://docs.gurock.com/testrail-userguide/howto-import-csv

Do you use a self-hosted installation of TestRail or TestRail Cloud? The CSV import was added with TestRail 4.1 last year and if you don’t see this feature then you would need to update your TestRail installation (ideally to the latest version). TestRail Cloud instances always use the latest version.

http://docs.gurock.com/testrail-admin/installation-upgrading

I hope this helps!

Cheers,
Tobias


#7

I am using the latest version (5.3.0.3603) and what you described worked. Also, I noticed that the exported CVS files already have the section Hierarchy that you specified already, except that it is within the Section Hierarchy, and not the Section column. So, I just copy to the Section column.

My question is since the system is smart enough to export the section hierarchy information, why can’t it put the information in the right column?

Seth


#8

Hi Seth,

Thanks for your posting. The CSV export of TestRail is not necessarily intended for importing again and it’s mostly meant for interop with other tools or post-processing data easily with other tools (such as Excel). For exporting/importing from one TestRail instance to another, we recommend using the XML exports instead or to copy the database if you want an exact copy (e.g. for a staging system). To copy cases within the same TR instance, you can also simply use the Copy/Move Test Cases dialog instead. The CSV import is mostly meant for importing data from other systems but you can also use it to import data from another TR instance and you can then simply map Section Hierarchy to Section in this case.

Cheers,
Tobias


#9

Hi Tobias,
One more question about ability to import suite from csv. I am also can not manage to import suite with correct separate step. In my case all separated steps becomes as text list inside first separated step. An can not be divided for multiple separated steps.
In my case it is really necessary feature because our customer usually providing list of web-pages in excel format and I am not able to use for import XML because of huge effort for conversion from excel to XML.


#10

Hi Sergey,

Thanks for your reply! I believe I’ve answered this in the other thread, but please let me know if you still need any assistance with this.

Regards,
Marco


#11

Hello,
How do I import tests from .csv files into the existing Sections/sub-sections?

I already tried specifying hierarchy for example General>Users, but instead putting the test into existing section, a new section has been created, and it has the same labels as the exiting one, so basically after import my sections have been duplicated and I have to do a lot of manual work to assign tests properly.