"No tests found for given includes" error when run Gradle tests on CircleCI

Viewed 185

I have a Kotlin project with some test files to run in parallel in CircleCI. And my config.yml file is as below:

jobs: 
  build:

    working_directory: ~/my-directory

    machine: true

    parallelism: 2

    steps:
      - checkout

      - restore_cache: 
          key: jars-{{ checksum "build.gradle" }}

      - run: ./gradlew dependencies

      - save_cache: 
          paths:
            - ~/.gradle
          key: jars-{{ checksum "build.gradle" }}

      - run:
          name: Clean tests
          command: |
            CLASSNAMES=$(circleci tests glob "**/*Test.kt" \
              | sed 's@/@.@g' \
              | sed 's/.kt//' \
              | circleci tests split --split-by=timings --timings-type=classname)
            GRADLE_ARGS=$(echo $CLASSNAMES | awk '{for (i=1; i<=NF; i++) print "--tests",$i}')
            echo "Prepared arguments for Gradle: $GRADLE_ARGS"
            ./gradlew test $GRADLE_ARGS

But when I build this project in CircleCI, I received this error on ./gradlew test $GRADLE_ARGS line:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':core:test'.
> No tests found for given includes: [FirstTest, SecondTest,...]

* 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

I've read CircleCI's instruction on https://circleci.com/docs/2.0/language-java/ and fix my code to same with the sample, but it still not working.

Can you tell me what I went wrong? Thank you!

Note: I'm using CircleCI 2.1

0 Answers
Related