赛普拉斯与DevOps的集成 [英] Cypress Integration with DevOps

查看:76
本文介绍了赛普拉斯与DevOps的集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要实现的目标:

我在Azure DevOps上有一个存储我的Web应用程序的存储库.我使用赛普拉斯为UI自动化编写了一个测试套件.我为测试用例创建了一个单独的存储库,以检查它们是否正常工作.我创建了一个具有以下内容的管道:

I have a repository on Azure DevOps which hosts my web application. I wrote a test suite for UI Automation using Cypress. I created a separate repository for my test cases to check if they are working properly or not. I created a pipeline which has the following content:

trigger:
- manual-tests
pool:
  vmImage: 'ubuntu-latest'

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '10.x'
  displayName: 'Install Node.js'

- script: |
    npm install
  displayName: 'npm install'

- task: Npm@1
  inputs:
    command: 'custom'
    customCommand: 'run test'
  continueOnError: true

- task: PublishTestResults@2
  inputs:
    testResultsFormat: 'JUnit'
    testResultsFiles: '**/test-output-*.xml'
    testRunTitle: 'My Test Cases'

我将触发器设置为存储UI自动化代码的存储库的一个分支.我想要的是,当对Web应用程序存储库的某个分支进行推送时,触发自动化脚本.有没有办法做到这一点?我们可以将测试用例文件存储在应用程序存储库中,并提供测试脚本的路径吗?

I have a trigger set to a branch of the repository in which my UI Automation code is stored. What I want is, to trigger my automation script, when there is a push on some branch of the web application repository. Is there a way of doing this? Can we store our test case files in the application repository and give the path of the test script?

推荐答案

似乎 UI自动化存储库 Web应用存储库是两个单独的存储库.

It seems that the UI Automation Repo and Web Application Repo are two separate repos.

要触发我的自动化脚本,请在Web应用程序存储库的某个分支上进行推送.有办法吗?

To trigger my automation script, when there is a push on some branch of the web application repository. Is there a way of doing this?

功能:触发来自不同仓库的管道".现在不可用.

The function: "trigger a pipeline from a different repo" is not available now.

此功能仍在开发中.Azure devops服务将很快提供对YAML管道的多存储库支持.

This feature is still under development. Multi-repository support for YAML pipelines will be available soon for azure devops service.

请检查以下功能:"YAML管道的多存储库支持";在 Azure DevOps功能时间表2020 Q2 中.该功能将于2020年7月底向所有人推出.

Please check the function:"Multi-repository support for YAML pipelines" in Azure DevOps Feature Timeline 2020 Q2. This feature will roll out to everyone by the end of July 2020.

解决方法:

您可以尝试使用管道触发.

以下是步骤:

步骤1:使用Web应用程序存储库创建管道,然后可以设置触发器分支.

Step1: Create a pipeline with web application repository, then you could set the trigger branch.

步骤2:在Yaml文件(UI自动化仓库)中添加管道触发器.

Step2: Add the Pipeline trigger in the Yaml file (UI Automation Repo).

例如:

resources:
  pipelines:
  - pipeline: Name   
    source: Pipeline name
    trigger: 
      branches:
      - releases/*
      - master

在Web应用程序存储库中进行更改时,将触发Web应用程序的管道.

When you make changes in web application repository, the pipeline with the web application will be triggered.

运行管道之后,将触发具有UI自动化仓库的管道.

After running the pipeline , the pipeline with UI Automation repo will be triggered.

我们可以将测试用例文件存储在应用程序存储库中,并提供测试脚本的路径吗?

Can we store our test case files in the application repository and give the path of the test script?

当然.你可以做到的.

如果要在管道中使用测试文件(UI自动化存储库),则可以添加

If you want to use the test file in the pipeline (UI Automation repo), you could add the repo resouces in the pipeline.

例如:

resources:
  repositories:
  - repository: MyAzureReposGitRepository
    type: git
    name: MyProject/WebapplicationRepo
...
steps:
- checkout: MyAzureReposGitRepository

注意:回购将签出到代理源文件夹.

Note: the repo will be check out to the Agent Source Folder.

希望这会有所帮助.

这篇关于赛普拉斯与DevOps的集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆