在集成文件夹中,我目前有4个文件夹:
|- seeding [Folder1]
| |- seeding1
| |- seeding2
| |- seeding3
| |- ...
|
|- testing-feature-1 [Folder2]
| |- test1
| |- test2
| |- test3
| |- ...
|
|- testing-feature-2 [Folder3]
| |- test4
| |- test5
| |- test6
| |- ...
|
|- testing-feature-3 [Folder4]
| |- test7
| |- test8
| |- test9
| |- ...
在我的脑海中,随着时间的推移会出现更多的“ testing-feature-x”文件夹。
我希望能够控制要运行的文件夹。现在,我可以运行“所有测试”,也可以运行一个。我是唯一一个缺少“在文件夹中运行规格”的人吗?还是勾选框,以选择要运行的测试?
在以下两种情况下,这将很有用:
npx cypress run --spec 'cypress/integration/testing-feature-2/**/*' --browser canary --no-exit
npx cypress run --spec 'cypress/integration/testing-feature-2/**/*' --browser canary --no-exit
npx cypress run --spec 'cypress/integration/testing-feature-3/**/*' --browser canary --no-exit
是否有更好的方法?
答案 0 :(得分:3)
您可以在一些npm脚本的帮助下完成所需的操作,从而省去了重复键入乏味命令的麻烦。
在package.json中执行以下操作:
public static void main(String[] args) {
Map<Integer, String> map = new HashMap<>();
map.put(30, "");
map.put(20, "");
map.put(50, "");
map.put(60, "");
map.put(70, "");
System.out.println(map.containsKey(20));
}
}
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> invalid stream header: 00000000
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to
get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5s
将在"scripts": {
"cypress:open": "cypress open",
"cypress:open:feature-1": "cypress open --config integrationFolder=tests/cypress/integration/feature-1",
"cypress:open:feature-2": "cypress open --config integrationFolder=tests/cypress/integration/feature-2"
}
文件夹中运行测试
npm run cypress:open
将在integration
文件夹中运行测试
您可以将种子函数放入npm run cypress:open-feature-1
中,并将其添加到全局对象中,如下所示:
integration/feature-1
在测试脚本中,您可以使用以下代码行调用此函数:
cypress/support/index.js
我希望对您有帮助