我想知道是否可以基于xUnit进行性能测试?
I wonder if it is possible to run performance testing based on xUnit?
不确定您到底要问什么,但您可以轻松编写自己的自定义属性来做到这一点。举个例子......
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] public class TraceAttribute : BeforeAfterTestAttribute { public override void Before(MethodInfo methodUnderTest) { //Start timer } public override void After(MethodInfo methodUnderTest) { //End timer } }
然后用 this 属性装饰你的单元测试。还要确保写入输出;)
Not sure what exactly you asking, but you can easily write your own custom attribute to do that. For an example..
Then decorate your Unit Test with the this attribute. Also make sure you write to an output ;)
对于 JUnit,您可以查看 JUnitPerf。
如果您使用不同的语言和不同的 xUnit,JunitPerf 设计概念(装饰正常的 JUnit 测试)和代码可能会提供如何在您的语言中执行相同操作的想法。
For JUnit, you might look at JUnitPerf.
If you're working in a different language and a different xUnit, the JunitPerf design concept (decorating normal JUnit tests) and code might give ideas of how to do the same in your language.
现在Github上有一个项目: https://github.com/Microsoft/xunit-performance
它提供了 xUnit 的扩展来编写性能测试(基准测试)。
Now there is a project on Github : https://github.com/Microsoft/xunit-performance
It provides extensions over xUnit to author performance tests (benchmark).
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(3)
不确定您到底要问什么,但您可以轻松编写自己的自定义属性来做到这一点。举个例子......
然后用 this 属性装饰你的单元测试。还要确保写入输出;)
Not sure what exactly you asking, but you can easily write your own custom attribute to do that. For an example..
Then decorate your Unit Test with the this attribute. Also make sure you write to an output ;)
对于 JUnit,您可以查看 JUnitPerf。
如果您使用不同的语言和不同的 xUnit,JunitPerf 设计概念(装饰正常的 JUnit 测试)和代码可能会提供如何在您的语言中执行相同操作的想法。
For JUnit, you might look at JUnitPerf.
If you're working in a different language and a different xUnit, the JunitPerf design concept (decorating normal JUnit tests) and code might give ideas of how to do the same in your language.
现在Github上有一个项目: https://github.com/Microsoft/xunit-performance
它提供了 xUnit 的扩展来编写性能测试(基准测试)。
Now there is a project on Github : https://github.com/Microsoft/xunit-performance
It provides extensions over xUnit to author performance tests (benchmark).