0

I inherited a couple dozen automated java tests that write test result failures to individual CSV files. Instead, I'd like to write to one CSV file with separate tabs per test. I haven't found how or if this is possible, has anyone had success writing multiple test results to one csv file?

  • 1
    Maybe I've misunderstood but is what you need an excel file with tabs containing each test's results ? CSV is one tab per file surely – Amias Jan 23 at 20:32
  • Yes, the previous engineer left an outstanding task to "Achieve all failures in one CSV". If not csv, I am trying to understand what alternatives I can achieve. @Amias – kylokyler Jan 23 at 23:08
  • You would have to use Microsoft Interop to accomplish this, and I do not recommend this approach at all. How about Log4Net instead? – Brian Jan 23 at 23:34
1

This seems like a red herring to me.

CSV is really a single table data format, it's not a normal way to output test results, it lacks proper metacharecter escaping and you can't name you data beyond rows or columns. This suggests to me that you test code doesn't use a framework which is a bit scary.

There are many formats for outputting test results that have more useful schemas and can handle all the quoting. Such as xunit , junit or nunit.

As you are using java junit is probably a good choice as most java test runners with have a flag to output junit to a file. Most CI systems can be configured to store and display those results.

Lots of tools can work with these formats but you won't be able to see then in ms office., Therefore don't make these changes without checking with others first

0

You could have an after test process that reads the contents of all CSVs in the test output folder (wherever the CSVs are stored) then writes each row to the same file. You could add an additional column that shows the test suite that the result originally came from.

You could achieve this with something like Apache Commons CSV.

Without seeing what is producing your results CSVs, or knowing what testing libraries you're using, it's hard to give more specific advice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.