问题设置Facebook截图测试为Android的gradle插件

问题描述 投票:1回答:1

我需要为android实现截屏测试。

我按照https://facebook.github.io/screenshot-tests-for-android/#gradle-setup上的步骤操作,并在gradle文件中包含以下内容

buildscript {
    // ...
    dependencies {
      // ...
      classpath 'com.facebook.testing.screenshot:plugin:0.9.0'
    }
  }

  apply plugin: 'com.facebook.testing.screenshot'

但是,我收到一个错误

评估根项目'app-android'时出现问题。无法应用插件[id'com.facebook.testing.screenshot']未找到名称为“androidTestImplementation”的配置。

我的build.gradle中有以下内容

androidTestImplementation 'androidx.test:core:1.1.0'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
androidTestImplementation 'androidx.multidex:multidex-instrumentation:2.0.0'

我找不到任何我需要的证据。

我也在https://github.com/facebook/screenshot-tests-for-android上看过

您需要python-2.7才能使gradle插件正常工作,我们还建议安装python-pillow库,这是记录和验证屏幕截图所必需的。

我已经安装了,看到我有2.7.16版本我已经安装了枕头推荐(v6.0.0)

android android-testing
1个回答
3
投票

你可能需要移动这一行:

apply plugin: "com.facebook.testing.screenshot"

进入模块级别build.gradle。它必须低于这一行:

apply plugin: "com.android.application"

因为那是androidTestImplementation的来源。

© www.soinside.com 2019 - 2024. All rights reserved.