Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-1885

Allow test methods in "core" to be individually run from outside of the IDE

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.9.0.0
    • system tests
    • None

    Description

      Gradle in combination with Java plugin allows test "filtering" which lets users run select test classes or even select test methods from the command line. See "Test filtering" section here http://www.gradle.org/docs/2.0/userguide/java_plugin.html#sec:java_test which has examples of the commands. Currently we have this working in the "clients" and I can run something like:

      ./gradlew clients:test --tests org.apache.kafka.clients.producer.MetadataTest.testMetadataUpdateWaitTime
      

      and that command then only runs that specific test method (testMetadataUpdateWaitTime) from the MetadataTest class.

      To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: http://gradle.org/docs/2.0/userguide/gradle_daemon.html.
      Building project 'core' with Scala version 2.10.4
      :clients:compileJava UP-TO-DATE
      :clients:processResources UP-TO-DATE
      :clients:classes UP-TO-DATE
      :clients:compileTestJava UP-TO-DATE
      :clients:processTestResources UP-TO-DATE
      :clients:testClasses UP-TO-DATE
      :clients:test
      
      org.apache.kafka.clients.producer.MetadataTest > testMetadataUpdateWaitTime PASSED
      
      BUILD SUCCESSFUL
      
      Total time: 12.714 secs
      

      I've found this useful when I need to do some quick tests and also reproduce issues that aren't noticed sometimes if the whole test class is run.

      This currently only works for the "clients" and not for "core" -because the "core" doesn't have the Java plugin applied to it in the gradle build-. I've a patch which does that (and one other related thing) which then allowed me to run individual test methods even for the core tests. I will create a review request for it.

      Edit: I was wrong about the java plugin not being applied to "core". It is indeed already applied but my attempt to get test methods running individually for "core" were failing for a different reason related to JUnit version dependency. I'll be addressing that in the patch and uploading for review.

      Attachments

        1. KAFKA-1885_2015-01-24_17:21:59.patch
          2 kB
          Jaikiran Pai
        2. KAFKA-1885_2015-01-24_10:42:46.patch
          0.8 kB
          Jaikiran Pai
        3. KAFKA-1885.patch
          0.8 kB
          Jaikiran Pai

        Activity

          People

            jaikiran Jaikiran Pai
            jaikiran Jaikiran Pai
            Neha Narkhede Neha Narkhede
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: