在测试执行前启动不同的应用程序 - 怎么做? [英] Start different Applications before Test execution - How do?
问题描述
我们需要启动几个不同的Windows控制台应用程序(服务) - 并且还要让它们保持运行 - 我们的测试才能进行功能测试可以开始。
我们应该怎样做(并确保)在测试期间收集来自此控制台应用程序的数据?
应该我们用脚本启动它们(从实验室管理部署后是* .bat?)
还有其他推荐的方法吗?
谢谢
Hi,
for our functional tests we have to start several diffrent Windows Console Applications (Services) - and also keep them running - before our tests could start.
How should we do this (and ensure) that data from this Console Application are collected during the tests?
Should we start them with a script (*.bat after deploy from the Lab Management?)
Is there a other recommended way?
Thanks
推荐答案
从你的帖子不清楚但我假设您正在使用MsTest进行功能测试,并且它是自动化的。这里有很多可能性,但我倾向于这样做:
It isn't clear from your post but I'm assuming you are using MsTest for your functional testing and that it is automated. There's lots of possibilities here but I tend to do this:
1。要启动任何外部应用程序,我创建一个标有AssemblyInitilalize或ClassInitialize属性的方法(取决于您希望如何测试范围)并将启动逻辑放在那里。
1. To start any external applications, I create a method marked with the AssemblyInitilalize or ClassInitialize attribute (depends on how you want to scope your tests) and put the startup logic in there.
2。要停止任何外部应用程序,我释放标有AssemblyCleanup或ClassCleanup属性的方法中的所有内容。
2. To stop any external applications, I free everything in methods marked with the AssemblyCleanup or ClassCleanup attributes.
initialize方法接受一个TestContext对象(由MsTest主机提供),公开TestResults目录那个测试运行。您可以使用该目录存储您的服务可能创建的任何日志:
The initialize methods accept a TestContext object (provided by the MsTest host) that exposes the TestResults directory for that Test Run. You can use that directory to stash any logs your services might create:
干杯!
灰色火腿
这篇关于在测试执行前启动不同的应用程序 - 怎么做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!