I have setup the codemagic.yaml and Patrol package for testing the integration test cases but I am facing one issue

huangapple go评论84阅读模式
英文:

I have setup the codemagic.yaml and Patrol package for testing the integration test cases but I am facing one issue

问题

这是我的.yaml文件用于CI/CD。我使用了patrol包来编写测试用例。[https://patrol.leancode.co/getting-started/getting-started][1]

workflows:
  android_dev_workflow:
    name: workflow for integration testing
    instance_type: mac_mini_m1
    environment:
      groups:
        - google_credentials
      flutter: 3.7.3
      xcode: 14.2
      cocoapods: default
      vars:
        FIREBASE_DEV_PROJECT: "hlp-dev"
    scripts:
      - name: get flutter packages
        script: |
          flutter pub get
          flutter pub run build_runner build --delete-conflicting-outputs
          dart pub global activate patrol_cli          
      - name: create debug and test apk
        script: |
                    patrol build android  --target integration_test/hlp_test/hlp_test.dart --flavor dev
      - name: Run Firebase Test Lab Tests
        script: |
          set -ex
          echo $GCLOUD_DEV_KEY_FILE | base64 --decode > ./gcloud_dev_key_file.json
          gcloud auth activate-service-account --key-file=gcloud_dev_key_file.json
          gcloud --quite config set project $FIREBASE_DEV_PROJECT
          gcloud firebase test android run \
            --type instrumentation \
            --app build/app/outputs/apk/debug/app-debug.apk \
            --test build/app/outputs/apk/androidTest/debug/app-debug-androidTest.apk          
    artifacts:
      - build/**/outputs/**/*.apk
      - build/**/outputs/**/*.aab
      - build/**/outputs/**/mapping.txt
      - flutter_drive.log
    publishing:
      email:
        recipients:
          - yogesh@pietechsolution.com

我在这一行上遇到了错误
patrol build android --target integration_test/hlp_test/hlp_test.dart --flavor dev.

这是我的输出日志

启用详细模式。将打印更多日志。

接收测试目标:/Users/builder/clone/integration_test/hlp_test/hlp_test.dart

接收Android风格:dev

接收5个--dart-define(0个自定义,5个内部)

接收内部--dart-define:PATROL_WAIT=0

接收内部--dart-define:PATROL_APP_PACKAGE_NAME=com.hlp.user.dev

接收内部--dart-define:PATROL_ANDROID_APP_NAME=HLP Dev

接收内部--dart-define:PATROL_TEST_LABEL=hlp_test.dart

接收内部--dart-define:INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false

• 使用入口点hlp_test.dart构建apk...

$ ./gradlew :app:assembleDevDebug -Ptarget=/Users/builder/clone/integration_test/hlp_test/hlp_test.dart -Pdart-defines=UEFUUk9MX1dBSVQ9MA==,UEFUUk9MX0FQUF9QQUNLQUdFX05BTUU9Y29tLmhscC51c2VyLmRldg==,UEFUUk9MX0FORFJPSURfQVBQX05BTUU9SExQIERldg==,UEFUUk9MX1RFU1RfTEFCRUw9aGxwX3Rlc3QuZGFydA==,SU5URUdSQVRJT05fVEVTVF9TSE9VTERfUkVQT1JUX1JFU1VMVFNfVE9fTkFUSVZFPWZhbHNl

/bin/sh: ./gradlew: No such file or directory
✗ Failed to build apk with entrypoint hlp_test.dart (Gradle build failed with code 127) (9ms)

异常:Gradle构建失败,代码127

#0 AndroidTestBackend.build.<anonymous closure> (package:patrol_cli/src/android/android_test_backend.dart:67:9)

<asynchronous suspension>

#1 DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:44:7)

<asynchronous suspension>

#2 AndroidTestBackend.build (package:patrol_cli/src/android/android_test_backend.dart:42:5)

<asynchronous suspension>

#3 BuildAndroidCommand.run (package:patrol_cli/src/commands/build_android.dart:117:7)

<asynchronous suspension>

#4 CommandRunner.runCommand (package:args/command_runner.dart:212:13)

<asynchronous suspension>

#5 PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:311:18)

<asynchronous suspension>

#6 PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:255:18)

<asynchronous suspension>

#7 patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:65:20)

<asynchronous suspension>

#8 main (file:///Users/builder/.pub-cache/hosted/pub.dev/patrol_cli-1.1.11/bin/main.dart:6:20)

<asynchronous suspension>

请查看上面的日志以了解发生了什么。还考虑使用--verbose运行。如果日志仍然不实用,请报告错误。

异常:Gradle构建失败,代码127

#0 AndroidTestBackend.build.<anonymous closure> (package:patrol_cli/src/android/android_test_backend.dart:67:9)

<asynchronous suspension>

#1 DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:44:7)

<asynchronous suspension>

#2 AndroidTestBackend.build (package:patrol_cli/src/android/android_test_backend.dart:42:5)

<asynchronous suspension>

#3 BuildAndroidCommand.run (package:patrol_cli/src/commands/build_android.dart:117:7)

<asynchronous suspension>

#4 CommandRunner.runCommand (package:args/command_runner.dart:212:13)

<asynchronous suspension>

#5 PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:311:18)

<asynchronous suspension>

#6 PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:255:18)

<asynchronous suspension>

#7 patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:65:20)

<asynchronous suspension>

#8 main (file:///Users/builder/.pub-cache/hosted/pub.dev/patrol_cli-1.1.11/bin/main.dart:6:20)

<asynchronous suspension>

构建失败 I have setup the codemagic.yaml and Patrol package for testing the integration test cases but I am facing one issue

第4步脚本“创建调试和测试apk”退出,状态码为1


  [1]: https://patrol.leancode.co/getting-started/getting-started

<details>
<summary>英文:</summary>

here is my .yaml file for CI/CD . I used the patrol package for write test cases. [https://patrol.leancode.co/getting-started/getting-started][1]

    workflows:
     android_dev_workflow:
        name: workflow for integration testing
        instance_type: mac_mini_m1
        environment:
           groups: 
            - google_credentials 
           flutter: 3.7.3
           xcode: 14.2
           cocoapods: default
           vars: 
             FIREBASE_DEV_PROJECT: &quot;hlp-dev&quot;
        scripts: 
          - name: get flutter packages
            script: |
                flutter pub get
                flutter pub run build_runner build --delete-conflicting-outputs
                dart pub global activate patrol_cli
          - name: create debug and test apk
            script: |
                patrol build android  --target integration_test/hlp_test/hlp_test.dart --flavor dev
          - name: Run Firebase Test Lab Tests
            script: |
                set -ex
                echo $GCLOUD_DEV_KEY_FILE | base64 --decode &gt; ./gcloud_dev_key_file.json
                gcloud auth activate-service-account --key-file=gcloud_dev_key_file.json
                gcloud --quite config set project $FIREBASE_DEV_PROJECT
                gcloud firebase test android run \
                  --type instrumentation \
                  --app build/app/outputs/apk/debug/app-debug.apk \
                  --test build/app/outputs/apk/androidTest/debug/app-debug-androidTest.apk
        artifacts:
           - build/**/outputs/**/*.apk
           - build/**/outputs/**/*.aab
           - build/**/outputs/**/mapping.txt
           - flutter_drive.log        
        publishing:
          email:
            recipients:
               - yogesh@pietechsolution.com

I am facing the error on this line 
**patrol build android  --target integration_test/hlp_test/hlp_test.dart --flavor dev.**

Here is my output logs 

Verbose mode enabled. More logs will be printed.

Received test target: /Users/builder/clone/integration_test/hlp_test/hlp_test.dart

Received Android flavor: dev

Received 5 --dart-define(s) (0 custom, 5 internal)

Received internal --dart-define: PATROL_WAIT=0

Received internal --dart-define: PATROL_APP_PACKAGE_NAME=com.hlp.user.dev

Received internal --dart-define: PATROL_ANDROID_APP_NAME=HLP Dev

Received internal --dart-define: PATROL_TEST_LABEL=hlp_test.dart

Received internal --dart-define: INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false

• Building apk with entrypoint hlp_test.dart...

$ ./gradlew :app:assembleDevDebug -Ptarget=/Users/builder/clone/integration_test/hlp_test/hlp_test.dart -Pdart-defines=UEFUUk9MX1dBSVQ9MA==,UEFUUk9MX0FQUF9QQUNLQUdFX05BTUU9Y29tLmhscC51c2VyLmRldg==,UEFUUk9MX0FORFJPSURfQVBQX05BTUU9SExQIERldg==,UEFUUk9MX1RFU1RfTEFCRUw9aGxwX3Rlc3QuZGFydA==,SU5URUdSQVRJT05fVEVTVF9TSE9VTERfUkVQT1JUX1JFU1VMVFNfVE9fTkFUSVZFPWZhbHNl

**/bin/sh: ./gradlew: No such file or directory
✗ Failed to build apk with entrypoint hlp_test.dart (Gradle build failed with code 127) (9ms)**

Exception: Gradle build failed with code 127

#0 AndroidTestBackend.build.&lt;anonymous closure&gt; (package:patrol_cli/src/android/android_test_backend.dart:67:9)

&lt;asynchronous suspension&gt;

#1 DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:44:7)

&lt;asynchronous suspension&gt;

#2 AndroidTestBackend.build (package:patrol_cli/src/android/android_test_backend.dart:42:5)

&lt;asynchronous suspension&gt;

#3 BuildAndroidCommand.run (package:patrol_cli/src/commands/build_android.dart:117:7)

&lt;asynchronous suspension&gt;

#4 CommandRunner.runCommand (package:args/command_runner.dart:212:13)

&lt;asynchronous suspension&gt;

#5 PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:311:18)

&lt;asynchronous suspension&gt;

#6 PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:255:18)

&lt;asynchronous suspension&gt;

#7 patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:65:20)

&lt;asynchronous suspension&gt;

#8 main (file:///Users/builder/.pub-cache/hosted/pub.dev/patrol_cli-1.1.11/bin/main.dart:6:20)

&lt;asynchronous suspension&gt;

See the logs above to learn what happened. Also consider running with --verbose. If the logs still aren&#39;t useful, then it&#39;s a bug - please report it.

Exception: Gradle build failed with code 127

#0 AndroidTestBackend.build.&lt;anonymous closure&gt; (package:patrol_cli/src/android/android_test_backend.dart:67:9)

&lt;asynchronous suspension&gt;

#1 DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:44:7)

&lt;asynchronous suspension&gt;

#2 AndroidTestBackend.build (package:patrol_cli/src/android/android_test_backend.dart:42:5)

&lt;asynchronous suspension&gt;

#3 BuildAndroidCommand.run (package:patrol_cli/src/commands/build_android.dart:117:7)

&lt;asynchronous suspension&gt;

#4 CommandRunner.runCommand (package:args/command_runner.dart:212:13)

&lt;asynchronous suspension&gt;

#5 PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:311:18)

&lt;asynchronous suspension&gt;

#6 PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:255:18)

&lt;asynchronous suspension&gt;

#7 patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:65:20)

&lt;asynchronous suspension&gt;

#8 main (file:///Users/builder/.pub-cache/hosted/pub.dev/patrol_cli-1.1.11/bin/main.dart:6:20)

&lt;asynchronous suspension&gt;

Build failed :|

Step 4 script `create debug and test apk` exited with status code 1


  [1]: https://patrol.leancode.co/getting-started/getting-started

</details>


# 答案1
**得分**: 1

解决方案是生成`gradlew`。您可以首先尝试构建您的Flutter应用程序(它会生成这个文件),例如使用`flutter build apk || true`。

<details>
<summary>英文:</summary>

The solution is to generate `gradlew`. You can just try building your flutter app first (it&#39;ll generate this file), e.g. by `flutter build apk || true`.

</details>



huangapple
  • 本文由 发表于 2023年6月15日 19:46:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/76482143.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定