如何在 Nunit 中的灯具之间共享重物?

发布于 2024-10-14 02:50:37 字数 142 浏览 12 评论 0原文

全部。 我使用 NUnit 进行了一些集成测试,并且需要为每个装置进行长时间运行的客户端设置。对我来说,最好只设置客户端一次。这将显着减少总时间。我现在使用父夹具中的静态字段来执行此操作。有没有更好的缓存方法?可能是一些背景信息等。

提前致谢,亚历克斯。

All.
I do some integration tests with NUnit and need a long running client setup per fixture. For me it will be good to setup the client only once. This will significantly reduce overall time. i do it now with a static field in the parent fixture. Is there a better way to cache it? Probably some context, etc.

Thanks in advance, Alex.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

那伤。 2024-10-21 02:50:37

我找到了适当的解决方案 - http://www.nunit。 org/index.php?p=setupFixture&r=2.5.9
它只会在任何固定装置之前执行一次,并将存储对重物的引用。任何固定装置都可以重复使用它。

i've found appropriate solution - http://www.nunit.org/index.php?p=setupFixture&r=2.5.9
it will be executed only once before any fixtures and will store reference to the heavy object. any fixtures can reuse it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文