locked
How to export the Test results of Test List Editor to excel--- Addin for VS2010 RRS feed

  • Question

  • Hi Team,

    I would like to create a VS addin, which will help me in exporting the Test results of Test List Editor in VSTS to Excel. It must look like, as we have an option of exporting the query results to Excel in SSMS, the same implementation i want to build as an addin in VS.

    Can anyone help me here in acheiving this task.

    or

    If if already have any workaround for this please let me know.

    I want the result to be displayed in the Excel as follows:


    • Moved by Mike Feng Wednesday, September 19, 2012 9:00 AM VSX (From:.NET Base Class Library)
    • Edited by K Priya Monday, October 1, 2012 7:37 AM
    Friday, September 14, 2012 11:19 AM

Answers

  • Hi Priya,

    I'm not entirely sure I agree with Joel's accessment. Importing data into Excel is entirely doable. Excel has a very robust automation model, that can certainly be leveraged to add data to an Excel spreadsheet or workbook. But as you noted, it's getting the Test Results data that is the blocking issue here.

    Just a quick note to let you know I did get a bug entry (feature request) into the TFS team asking them to consider adding something that'll expose this.

    Sincerely,


    Ed Dore

    Monday, November 5, 2012 11:43 PM

All replies

  • The simpliest was is to output the file as csv.  The CSV file is just a string with commas seperating the fields.  This may be problematic in your case excel will automatically recognize the data and convert to a known format.  This often convert number to time.

    You can use ADO.Net shown on webpage below.  You the code under the  label "The following code illustrates how to generate a tab-delimited text file from data that is read with ADO.NET: " which doesn't require adding the Excel Interop library which runs very slow.

    http://support.microsoft.com/kb/306023


    jdweng

    Friday, September 14, 2012 1:39 PM
  • Here i want to fetch the details from the TestListEditor test results, i wanna give the user a choice of selecting few rows and upon right click a context menu must appear which includes 'Export to excel' option. Upon clicking this the selected rows must fall into an excel sheet.

    Saturday, September 15, 2012 5:45 PM
  • Hi Priya,

    This issue is more related to Visual Studio Extensibility, so I moved it to this forum for better support.

    Thank you for your understanding and support.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, September 19, 2012 9:05 AM
  • Hi Priya,

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.
     
    Thank you for your understanding and support.

    Best regards,


    Ego [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, September 20, 2012 7:05 AM
  • Thank You,

    Can any one let me know what is the DataGrid name or ID used in the "Test Result" window which displayes the test results.

    Thanks in advance , ...

    Thursday, September 20, 2012 1:05 PM
  • I want to use the values displayed in the DataGrid of TestResult Window.

    Can anyone help me in extracting the values of TestResult DataGrid, how to access the values of this DataGrid. (Urgent requirement)

    Friday, September 21, 2012 6:30 AM
  • Friday, September 21, 2012 7:30 AM
  • HI Joel,

    I dint mean the datagrid implementation, I want to know how to access the testresults displays in the TestResult window of VSTS.

    Friday, September 21, 2012 7:53 PM
  • Unfortunately, this is an unsupported scenario. There just isn't any extensibility built around that particular toolwindow that would allow you to readily retrieve this info. I dug around both the VS 2010 and VS 2012 codebase (the VS 2012 toolwindow is a lot different), and they don't offer up any services or interfaces that'll allow you to get access to this info.

    In VS 2010 the info is stored in XML format in a .TRX file. And in VS 2012 it appears this info is now located in a .MDF file. But it doesn't look like there is any way to ask or determine which file is currently loaded into the Test Results toolwindow, making that a dead end as well :-(

    Sincerely,


    Ed Dore

    Tuesday, September 25, 2012 8:46 PM
  • Hi Ed Dore,

    Thanks for your answer, can u plz let me know whether i can access the XML -> .TRX file for VS2010 for the TestResult run which i made. If yes, please let me know the process.

    Please let me know, how to extract the result from .TRX files and load it into the Excel  file as i mentioned earlier.

    On one click, the TestResults must be exported to Excel sheet. I am working on this but unable to get the solution, help me here as it is taking lots of time to resolve this.  

    Thanks in advance.





    • Edited by K Priya Monday, October 1, 2012 7:10 AM
    Monday, October 1, 2012 4:23 AM
  • Per my earlier email, I was unable to find any way to do this. There just isn't any extensibility, exposed API's or interfaces that we can get at, that will tell us which .TRX file is currently loaded in the Test Results Toolwindow.

    I'm not overly famliar with Excel programability. If you have XML data that you wish to import into Excel, one of the forums like http://social.msdn.microsoft.com/Forums/en-US/exceldev/threads would be a good place to ask.

    But given that the Test Results toolwindow doesn't expose anything that will tell us which .TRX file is currently loaded, it sort of makes the 2nd issue (importing data into excel) rather moot. :-(

    Sincerely,


    Ed Dore

    Tuesday, October 2, 2012 5:53 PM
  • :( 

    Its so sad that we cannot use or access the Grid of VS2010 TestResult Window to export the results to an excel. I thought to prepare an addin which reduces the burder of a tester in exporting the results to excel.

    Hmm..... However still if there is any single possibility to achieve this please let me know.

    Thanks in advance :)

    Friday, October 5, 2012 4:05 AM
  • There are two back door methods of doing this.  One is to use OpenXML file format.  This give a very clean approach.  The second is a more traditional method() of using ADO net which workd well with strings, but has the annoyance of excel automatically changing numbers to dates.  Excel and Access are Front End Applications that Microsoft wrote using a driver like the Jet Engine to read and write to the databases (xls, mdb).  The Jet Engine is part of windows operating system so you don't have to an office license to use the Jet Engine.  You can connect to the database using most of the SQL conection methods.  The only thing is you can't format the excel spreadsheet using this method.

    jdweng

    Friday, October 5, 2012 9:11 AM
  • Hi Joel,

    Can we access the DataGrid of TestResult window?

    Wednesday, October 10, 2012 7:39 AM
  • I just finshed reading all your posting to completly understand the problem.  I missed the fact that you are trying to put an addin to excel to automatically do the exporting.  The Excel Application Class is the parent to the addin.  Any public function in an addin will look like a VBA macro to excel.  You can write an interface in your addin that will return to excel any value from your DataGrid.  Your addin is run as a macro can write to the excel worksheet.  If your addin is a function that goes into an excel cell then it should not write to any cells but instead return a single value to the function.

    Do you have any experience writing addins for excel application?  If not I recommend you doing a google search for C# addin for excel.


    jdweng

    Wednesday, October 10, 2012 11:38 AM
  • Just to clarify here Joel, the customer is asking about implementing an addin in the Visual Studio IDE, that will allow them to export data from the IDE's Test Results toolwindow, into Excel.

    I've examined the implementation of the Test Results toolwindow implementation, and the entire package it's implemented in, and I can confirm there is no supported way to do this.

    Sincerely,


    Ed Dore

    Thursday, October 11, 2012 6:54 PM
  • As said above, my requirement is:  implementing an addin in the Visual Studio IDE, that would allow me to export data from the IDE's Test Results toolwindow, into Excel.

    There could be something or the other way to access the IDE's Test Result toolwindow data grid, if not there will be no meaning of Addins in order to build something which is required by a customer/ user.

    If there is no way to do this, then i would request you people to add this scenario or implementation in any of your upcoming/ upgrading releases.

    Tuesday, October 16, 2012 4:45 AM
  • You are not alone.  Lots or people have the same issue.  Microsoft is trying to protect  the excel license which make it difficult to interface with excel.  That is why OPEN XML was developed.  Reade the specification on OPEN XML.

    http://en.wikipedia.org/wiki/Office_Open_XML

    http://www.ecma-international.org/publications/standards/Ecma-376.htm


    jdweng

    Tuesday, October 16, 2012 7:53 AM
  •  :(

    Exporting to Excel comes at the end.... which is not the problem now.

    I just need the way to access the TestResult window grid's data so that i can show those data grid values onto my UI.


    • Edited by K Priya Thursday, October 18, 2012 9:20 AM
    Thursday, October 18, 2012 7:49 AM
  • Hi Priya,

    I'm not entirely sure I agree with Joel's accessment. Importing data into Excel is entirely doable. Excel has a very robust automation model, that can certainly be leveraged to add data to an Excel spreadsheet or workbook. But as you noted, it's getting the Test Results data that is the blocking issue here.

    Just a quick note to let you know I did get a bug entry (feature request) into the TFS team asking them to consider adding something that'll expose this.

    Sincerely,


    Ed Dore

    Monday, November 5, 2012 11:43 PM
  • I have found that if you have access to SQL Studio, you can attach the .mdf left behind by VS2012 to its own database. If you then navigate to dbo.DBTestResultData, you'll see the raw information for part of the trx. It would be possible to use the tables in the .mdf file to create a results file. The rub here is you need to have your solution, and likely VS2012, closed to be able to access the .mdf file.
    Thursday, June 6, 2013 1:48 PM