如何为 Visual Studio 测试项目创建启动和清理脚本?

发布于 2024-08-22 12:10:10 字数 113 浏览 6 评论 0原文

我正在使用 Visual Studio 测试项目,正在使用部署文件等修改测试配置(通过 VS GUI),现在我需要为测试运行编写启动脚本。

我不知道这些脚本使用什么语言、文件类型或机制。需要小费。

I'm using a Visual Studio Test project, am modifying the test config with deployment files, etc. (through the VS GUI) and now I need to write a Startup script for the test run.

I have no clue what language or file type or mechanism is used for these scripts. Need a tip.

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

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

发布评论

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

评论(1

溺ぐ爱和你が 2024-08-29 12:10:10

在您的测试项目中创建单元测试。在单元测试类中,使用 [TestInitialize][TestCleanup] 属性创建方法。它们将在每个测试方法之前/之后运行。

或者,如果您想在该类中的所有测试之前/之后运行,请使用 [ClassInitialize][ClassCleanup] 属性创建静态方法。

最后,要在程序集中的所有测试之前/之后运行,请使用 [AssemblyInitialize][AssemblyCleanup] 属性创建静态方法。

Create a unit test in your test project. In the unit test class, create methods with the [TestInitialize] and [TestCleanup] attributes. They will be run before/after each test method.

Or, if you want to run before/after all test in that class, create static methods with [ClassInitialize] and [ClassCleanup] attributes.

Lastly, to run before/after all tests in the assembly, create static methods with [AssemblyInitialize] and [AssemblyCleanup] attributes.

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