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

Trouble with csv2testrail


#1

So I’ve been having a hell of a time getting csv2testrail to actually work. I’ve got my CSV file properly formatted and I’m just using the out of the box “simple” custom filter example. As you can see, using the --csv mode shows me that everything should be just fine:

[code]$ php csv2testrail.php custom_filter.php toast.csv …/suite.xml --csv

[0] => Array
(
[0] => Title
[1] => Type
[2] => Priority
[3] => Preconditions
[4] => Steps
[5] => ExpectedResult
[6] => Section
)

[1] => Array
    (
        [0] => Add audio files by dragging and dropping them into the Content Area
        [1] => Performance
        [2] => 2
        [3] => 
        [4] => 1. Select the Audio CD project
  1. Select the available audio files (if, wav, ac3, mpa, ec3, abs, mid, mp3, snd, au, mp2, m4a) in Finder window
  2. Drag and drop them into the Content Area
    [5] => The selected audio files will be added into the Content Area with no error
    [6] => Audio > Audio CD > Add audio files >
    )
    [/code]

Now, when I drop the mode, I get warnings about undefined offsets and my output is just bogus. Here’s what the terminal kicks back:

$ php csv2testrail.php custom_filter.php toast.csv ../suite.xml

Notice: Undefined offset: 6 in /Users/syncer/Desktop/csv2testrail/custom_filter.php on line 35
Notice: Undefined offset: 2 in /Users/syncer/Desktop/csv2testrail/custom_filter.php on line 20
Notice: Undefined offset: 3 in /Users/syncer/Desktop/csv2testrail/custom_filter.php on line 25
Notice: Undefined offset: 4 in /Users/syncer/Desktop/csv2testrail/custom_filter.php on line 26
Notice: Undefined offset: 5 in /Users/syncer/Desktop/csv2testrail/custom_filter.php on line 27
Notice: Undefined offset: 6 in /Users/syncer/Desktop/csv2testrail/custom_filter.php on line 35
Successfully converted 93 sections and 2 cases

And here’s an example of the XML file:

<?xml version="1.0" encoding="UTF-8"?>
<sections>
<section>
<name>Audio</name>
<sections>
<section>
<name>Audio CD</name>
<sections>
<section>
<name>Add audio files</name>
<sections>
</sections>
</section>
<section>
<name>Work with tracks</name>
<sections>
</sections>
</section>
<section>
<name>View or edit disc and track info</name>
<sections>
</sections>
</section>
<section>
<name>Work with crossfades</name>
<sections>
</sections>
</section>

Not at all like what I’m seeing with the CSV mode, right?

So what’s going on here? I thought it might be my line endings, but tried Windows and Unix to no avail.


#2

This is one sad problem after another.

So I found that I had a stray “>” in my sections definition, which was throwing off the script. Fixed that and we now have all my test cases. w00t.

Now I’ve got a suite.xml and guess what? It’s not a valid XML file. Not really sure why, but creating a blank XML file and pasting in the output seemed to clear up that mess.

So I’m finally at a point where I can import into TestRail. Guess what doesn’t work?

Hooray! I get the following error:

So I’m getting somewhere, which is better than no where, but still not reaching my goal.

Unfortunately, the above error doesn’t tell me anything about what section is causing the problem, so I’m really at a loss.


#3

I guess I should have just ignore my urge to post and figure it out myself. My “formatted” CSV file had some bogus crap in it that was causing me issues. Instead of trying to import all 2000 test cases, I broke it up in to 300-400 site chunks and worked with those smaller data sets.

I’m now running full steam and my teams have already started testing.

Lesson to be learned: If you’re having trouble, it’s probably bad data. Try importing smaller chucks and eventually, you’ll find the culprit.


#4

Hello AJ,

good to hear that it’s working now. I would now have suggested to send us the CSV file so that we can take a look and try it out ourselves (and possibly update the csv2testrail script). Just let me know in case there’s anything else and sorry for the inconvenience.

Regards,
Tobias


#5

Thanks Tobias. The only real problem I still had (which was easily cured) was the invalid XML files. I’m happy to send my CSV files to see what might be causing it.


#6

Yes, please send them to tg at gurock.com. I’m happy to take a look.

Regards,
Tobias