How to output log by log4net during MSTest UTs

Problem:

Do debugging in VS2010, the log file can be output.

But, when i use "MSTest.exe" to run the "testmethod", get no logs.


Solution:

1. Add the config files on log4net to the path contain assemblies that you want to run with "MSTest.exe"

2. "Enable Deployment" in Local.testsettings

3. Add attribute "DeploymentItem" to TestMethod.


I fix problem with solution #1 and #2.

I am not very clear on #3.

Will do researching on #3 later.


Also, we can get some information on this:

"

All three answers are correct, depending on your needs.

Adding files to deploy in the .testrunconfig (.testsettings in VS2010) will copy all of those files to every test output folder, even for unrelated tests run in isolation. If you run one test, all the test data files listed in the deployment section of .testssettings will be copied to the test output folder.

In my tests I need to copy an expected XML file to the test output folder to compare with the actual test output XML. I use the DeploymentItem attribute to only copy the XML file related to the test(s) being run. In VS2010 I had to enable deployment in the .testsettings file (but not add any paths) and then reference the XML file path relative to the TestProject in the DeploymentItem.

Hope this helps.

--  GraehamF

"

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值