locked
How to generate the customized log for unit testing in vs 2012? RRS feed

  • Question

  • Hi all:

             as we known,  if we run the unit test via vs2012, there will not be a .trx file. So I plan to write a customized log file.  After each test run, the customized log file will be created.  here is my solution:

    1. Create the file and write the content into the file when the test run is completed.

    here is the key issue:

    1. how to identify the test run will be completed? or how can i identify the current running test case is the last test case to be ran in the test run?

    Any idea about it? 

    thanks 

    Mztest

    Thursday, March 21, 2013 1:26 AM

Answers

  • Hello Mztest,

    Thank you for your post.

    As far as I know, even though that VS 2012 will not generate a .trx file after running unit test in VSIDE, you can use the MSTest Command Line option /resultsfile to generate the trx file. After you run test with MSTest, the .trx file will be generated in the Bin\debug folder.

    For more information, please see: MSTest.exe Command-Line Options

    And there is no option used to identify the current running test is the last test to be run in VS IDE. If you want to identify when the test run will be completed and if the current running test is the last test to be ran, I am afraid that you need to write your own code to track each test run.

    I think that customizing a log file programmatically will take a lot of works. I suggest that you use that method to generate a .trx file instead of writing a lot of code to create a log file.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Amanda Zhu Wednesday, March 27, 2013 8:14 AM
    Friday, March 22, 2013 3:01 AM

All replies

  • Hello Mztest,

    Thank you for your post.

    As far as I know, even though that VS 2012 will not generate a .trx file after running unit test in VSIDE, you can use the MSTest Command Line option /resultsfile to generate the trx file. After you run test with MSTest, the .trx file will be generated in the Bin\debug folder.

    For more information, please see: MSTest.exe Command-Line Options

    And there is no option used to identify the current running test is the last test to be run in VS IDE. If you want to identify when the test run will be completed and if the current running test is the last test to be ran, I am afraid that you need to write your own code to track each test run.

    I think that customizing a log file programmatically will take a lot of works. I suggest that you use that method to generate a .trx file instead of writing a lot of code to create a log file.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Amanda Zhu Wednesday, March 27, 2013 8:14 AM
    Friday, March 22, 2013 3:01 AM
  • Hello,

    Since we haven't heard from you for a long time, I temporarily close this case. I mark useful reply as answer. If you have any concerns, please feel free to reopen it or submit a new question.

    Thanks for your understanding.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, March 27, 2013 8:14 AM