maiflai / gradle-scalatest

A plugin to enable the use of scalatest in a gradle Scala project.
The Unlicense
73 stars 35 forks source link

Could not find method tags() #101

Open SHND opened 2 years ago

SHND commented 2 years ago

I'm trying to add tags to my tests and run them separately. using the

plugins {
  id 'com.github.maiflai.scalatest' version '0.25' // or '0.31' or '0.32'
} 

dependencies {
  testCompile 'org.scalatest:scalatest_2.13:3.2.0'
  testRuntime 'com.vladsch.flexmark:flexmark-all:0.35.10'
}

task MyTests(type: Test) {
  tags {
    include 'com.tag.definition.path'
  }
}

I'm using gradle 6.9.2.

When I try to compile and run the tests, I get Could not find method tags().

SHND commented 2 years ago

I just found that I have the same error for suite. Could not find method suite() ...

task MyTests(type: Test) {
  suite 'com.spec.path.to.test'
}
maiflai commented 2 years ago

sorry, I can't reproduce that.

please could you share a repository that fails?

SHND commented 2 years ago

Unfortunately it's a private repo which I cannot share. It is using Java (Spring) along with Scala. We have this also

test {
   useJUnitPlatform()
}

I'm not that great on Gradle, Is there a possibility of conflicts between plugins or dependencies? Do you have any guesses on where can I start looking and how can I debug this? What I'm effectively trying to do here, is to be able to run our UnitTests and IntegrationTests separately.

maiflai commented 2 years ago

Do you have ScalaTest and JUnit in the same module?

Or have you configured com.github.maiflai.gradle-scalatest.mode = append?

SHND commented 2 years ago

We have both Java tests and Scalatest in one repo and we are running them together through one build.gradle configuration. We also have com.github.maiflai.gradle-scalatest.mode = append in gradle.properties.

maiflai commented 2 years ago

The README has this (and it seems to work for me with the versions you quote above).

Please could you check that you have added the appropriate configure line?

If you then want to use scalatest to run other Test tasks, you can instruct this plugin to configure those tasks.

task myTest(dependsOn: testClasses, type: Test, group: 'verification') { com.github.maiflai.ScalaTestPlugin.configure(it) tags { include 'com.example.tags.MyTag' } }