简体   繁体   English

是否可以运行Visual Studio Team Services Build中的端到端测试?

[英]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)

  1. Log on to the machine using the account for which you've prepared permissions as explained above. 如上所述,使用为其准备了权限的帐户登录计算机。
  2. Go to the Agent pools control panel tab 转到“代理程序池”控制面板选项卡
  3. Click Download agent. 单击下载代理。
  4. Click Windows. 单击Windows。
  5. Click the Download button. 单击下载按钮。
  6. Run PowerShell as Administrator. 以管理员身份运行PowerShell。
  7. Run the commands under Create the agent. 运行“创建代理”下的命令。
  8. Run .\\config cmd 运行。\\ config cmd

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.

相关问题 在Visual Studio Team Services上构建Cordova项目时,构建失败 - Build fails when building Cordova project on Visual Studio Team Services AngularJS端到端测试使用Karma与静态文件而不是服务器 - AngularJS end-to-end tests using Karma with a static file instead of server 在GitLab CI作业上运行TestCafe Docker Image时出错。 尝试在BrowserStack上执行自动端到端测试 - Error running TestCafe Docker Image on GitLab CI job . Trying to execute automated end-to-end tests on BrowserStack AngularJs使用Java编写的现有Selenium测试进行端到端测试 - AngularJs end-to-end testing using existing Selenium tests written in Java 使用Jasmine进行端到端测试AngularJS应用 - End-to-End Testing AngularJS app with Jasmine Javascript中是否可以进行端到端加密? - Is End-to-end encryption possible in Javascript? 使用 Cypress 对应用进行端到端测试 - End-to-end test on application with Cypress 如何在Angular端到端测试中修改数组模型? - How can I modify an array model in an Angular end-to-end test? Visual Studio Team Services / SonarQube:将.trx / .coverage文件转换为LCOV吗? - Visual Studio Team Services / SonarQube: Converting a .trx/.coverage file to a LCOV? 在端到端测试中使用跨平台键盘快捷键 - Using cross-platform keyboard shortcuts in end-to-end testing
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM