使用dart_test.yaml,可以很容易地使用要跳过的特定标记来配置测试,也许可以使用覆盖。例如,配置chromeUnstableOnly标记以导致在所有平台上跳过,并设置"-P强制“预置以使其运行:
tags:
chromeUnstableOnly:
skip: "Not implemented on stable yet"
presets: {force: {skip: false}}在测试本身中,我可以为特定的平台配置一个跳转:
test('Foo Test', () {
// ...
}, onPlatform: {
'chrome_stable': new Skip('Not yet supported on stable.')
});是否可以根据dart_test.yaml中的标记配置特定于平台的跳过,以便在其他平台上跳过带有“chromeUnstableOnly”标记的单元测试?我想将我的测试定义如下:
test('Foo Test', () {
// ...
}, tags: ['chromeUnstableOnly']);我可以定义预置,并让预置选择平台:
# This works, but can I set a default preset for "pub run"?
presets:
stable:
exclude_tags: chromeUnstable
platforms:
- chrome_stable不过,我找不到一种方法来指定默认的预设。在平台下使用exclude_tags或add_presets似乎也不起作用:
define_platforms:
chrome_stable_with_exclude_tags
name: Chrome Stable
extends: chrome
exclude_tags: [chromeUnstableOnly] # does not seem to work
chrome_stable_with_preset
name: Chrome Stable
extends: chrome
add_presets: [stable] # does not seem to work发布于 2018-12-03 16:33:37
是的,通过将on_platform字段添加到标记中,可以跳过某些平台上的特定标记的测试:
tags:
chromeUnstableOnly:
on_platform:
chrome_stable:
skip: "Not implemented on stable yet. Use -P force to force tests."
presets: {force: {skip: false}}https://stackoverflow.com/questions/53597837
复制相似问题