gpt4 book ai didi

testing - 如何在每个拉取请求中运行特定测试?

转载 作者:行者123 更新时间:2023-11-28 20:10:13 25 4
gpt4 key购买 nike

假设我们有超过 1500 个测试,并且在 pull-request 合并到 master 分支之前,我们有一个始终运行测试的测试管道,并且所有测试都需要超过 45 分钟要运行的测试。其中一些测试不需要一次又一次地运行,而其中一些应该运行。

我们是否有解决方案来指定哪些测试应该在哪个拉取请求中运行,哪些测试不应在特定的拉取请求中运行,或者我应该这样问。我们能否以某种方式定义过滤器以指定应在 [X] 拉取请求中运行哪些测试?

最佳答案

您应该能够配置 phpunit 为特定分支运行特定测试,例如,在下面的配置中,phpunit 将为 master 分支运行所有测试,并且仅为与主分支匹配的任何分支运行测试子集feature/* 全局模式:

pipelines:
default:
- step:
name: Run all tests
script:
- phpunit mydir
branches:
master:
- step:
name: Run all tests
script:
- phpunit mydir
'feature/*':
- step:
name: Run only MyTest test class
script:
- phpunit --filter MyTest

或者,您应该能够根据 BITBUCKET_BRANCH environment variable 决定运行哪个测试:

pipelines:
default:
- step:
name: Run test that match the name of the branch
script:
- phpunit --filter "${BITBUCKET_BRANCH}"

关于testing - 如何在每个拉取请求中运行特定测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59057685/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com