简体   繁体   English

使用VSTS管道生产后进行Angular e2e测试

[英]Angular e2e testing after production with VSTS pipelines

I'm using VSTS build and release pipeline to deploy my angular application. 我正在使用VSTS构建和发布管道来部署我的角度应用程序。 there is 3 ways to run e2e tests: 有3种方式运行e2e测试:

1- In the build pipeline after installing npm and angular dependencies. 1- 安装npm和角度依赖关系之后的构建管道中

2- In the release pipeline after the deployment of my application. 2- 部署应用程序后的发布管道中

3- Locally before using VSTS pipelines. 3-使用VSTS管道之前在本地

If i run it in the build pipeline: How can i serve the angular app on certain port so that i can run the e2e on it during the build process in VSTS? 如果我在构建管道中运行它:如何在特定端口上服务angular应用程序,以便在VSTS的构建过程中可以在其上运行e2e?

If i run it in the release pipeline: The deployed app won't have the npm dependencies just have the dist folder so that i can't run ng e2e there. 如果我在发布管道中运行它:部署的应用程序将不具有npm依赖项,而只有dist文件夹,这样我就不能在那里运行ng e2e了。

If i run it locally: This is time consuming and not preferred. 如果我在本地运行:这很耗时,不是首选。

What is the best common way to run it? 最好的常见运行方式是什么?

I wouldn't advise on trying to run E2E tests on the Release Pipelines as these should be used to deploy a built app. 我不建议尝试在发布管道上运行E2E测试,因为这些测试应用于部署内置应用程序。

One common approach i have come across and use is to have 'E2E' tests run overnight or at a scheduled time daily due to it being a time consuming test and we don't want to block our build agents. 我遇到并使用的一种常见方法是使“ E2E”测试在一夜之间或每天按计划的时间运行,因为这是一项耗时的测试,并且我们不想阻止我们的构建代理。

If you have any unit tests i would run these as part of the Build pipeline. 如果您有任何单元测试,我将在构建管道中运行这些单元测试。

If you run the E2E in VSTS you will need to make sure you include the steps to do an NPM install and then the correct NG command to run the E2E test. 如果您在VSTS中运行E2E,则需要确保您包括执行NPM安装的步骤,然后输入正确的NG命令来运行E2E测试。 If you use Microsoft Provided Build Agent it should already include Google Chrome for you to test with. 如果您使用Microsoft提供的构建代理,则它应该已经包含Google Chrome供您测试。 Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM