[英]Can end-to-end tests in Visual Studio Team Services Build be run?
I have a set of mocha tests that launch Spectron to do end-to-end testing on an Electron application. 我有一组摩卡测试,可启动Spectron在Electron应用程序上进行端到端测试。
When I try to run the tests through npm run
, they just time out and fail. 当我尝试通过
npm run
运行测试时,它们只是超时而失败。 It seems that the application isn't launching. 该应用程序似乎没有启动。 There is a
Run Functional Tests
build step template in VSTS, but that's for an actual test DLL. VSTS中有一个
Run Functional Tests
构建步骤模板,但这是一个实际的测试DLL。 Is there something similar for Javascript end-to-end testing? Javascript端到端测试是否有类似的东西?
The Hosted Agent is running as the service, however launch Spectron to do test with Electron app need to interact with window and the test is running on build agent machine. 托管代理正在作为服务运行,但是启动Spectron以使用Electron应用程序进行测试需要与窗口进行交互,并且该测试正在构建代理计算机上运行。 So you need to setup a on premise build agent to do that test (works fine for me with this test sample. Build steps: npm install, npm install test)
因此,您需要设置一个本地构建代理来进行该测试( 此测试示例对我而言工作正常。构建步骤:npm install,npm install test)
More information to setup on premise build agent, you can refer to this article. 更多信息,关于前提下生成代理设置,你可以参考这个文章。
Since the tests need to interact with the desktop they are not a good fit for compile time where you dont usually have a running instance of your application. 由于测试需要与桌面进行交互,因此它们不适用于通常没有应用程序正在运行的实例的编译时。 Stick to pure unit tests at build time.
在构建时坚持纯单元测试。 A better fit would be to use Release Management to orchastrate those tests.
更好的选择是使用发布管理来组织这些测试。
That said, you can easily deploy your application (build or release) and the. 也就是说,您可以轻松地部署您的应用程序(构建或发布)和。 Use the Functional Testing task to initiate your UI interactive tasks.
使用功能测试任务来启动UI交互任务。 You need a machine with the Test Agent deployed, but there is a task for that too.
您需要一台部署了测试代理的机器,但是也有一个任务。
Since Functional (end to end) tests interact with the desktop you can only run one at once. 由于功能(端对端)测试与桌面交互,因此您一次只能运行一个。 This is fine if you only take a few minutes, but as you get more functional teats this can take way longer.
如果只花几分钟时间,这很好,但是随着功能性奶嘴的增加,这可能需要更长的时间。 The Functional Testing task allows you to split the test execution across multiple agents so that you can run the tests in parallel.
使用功能测试任务,您可以将测试执行分散到多个代理上,以便可以并行运行测试。
Since your alternative is to configure your own Build Agent in interactive mode you need a server anyway. 由于您的替代方法是以交互方式配置自己的Build Agent,因此无论如何都需要一台服务器。 You would be more future proofing to use this model from the start as you can scale.
如果可以扩展,从一开始就使用该模型将为您提供更多的未来证明。
If a Visual Studio Test Adapter is not available for your framework then you can create your own to let Visual Studio, and additionally the Functional Testing plugin, detect and execute any test framework. 如果您的框架没有可用的Visual Studio测试适配器,则可以创建自己的工具以让Visual Studio和功能测试插件检测并执行任何测试框架。 For Javascript you will find http://mortenhoustonludvigsen.github.io/JsTestAdapter/CreatingATestAdapter/ has some awesome examples of how to create a Jasmin Test Adapter as an example.
对于Javascript,您会找到http://mortenhoustonludvigsen.github.io/JsTestAdapter/CreatingATestAdapter/,其中有一些很棒的示例,这些示例说明了如何创建Jasmin测试适配器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.