triggering junit.xml output in standalone Spock script.groovy

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

triggering junit.xml output in standalone Spock script.groovy

Spock Framework mailing list
Given the below ultra-simple test script, I'm trying to figure out how to get junit.xml output.
When I run this, I only get a one-line on-screen summary to STDOUT:
JUnit 4 Runner, Tests: 1, Failures: 0, Time: 71

script:

#!/usr/bin/env groovy

@Grab(group='org.spockframework', module='spock-core', version='1.0-groovy-2.4')  // @Grapes()
import spock.lang.*  // pulls in non-defaults like @Unroll() and @Requires()

class HelloSpockSpec extends spock.lang.Specification {

  def "example single assertion about Spock"() {
    given:  "setup initial data"
      def attrStr = "logical"
    when:   "tweak data"
      def SpockAttr = attrStr
    then:   "assertions"
      SpockAttr == 'logical'
      println "0. PASS: ok -- SpockAttr == 'logical'"
  }

}

// EOF

How can I get junit.xml output? Note I'm not running under Maven or Gradle.

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: triggering junit.xml output in standalone Spock script.groovy

Spock Framework mailing list
Starting to figure out that Spock relies in jUnit for some things, like xUnit.XML output.
There may be a way to @Grab the right part of jUnit.
But for now, I experimented with converting my standalone script to be initiated by Maven.
The steps were:
1. import the @Grab Grapes into Maven XML <dependency> block(s).
2. comment out the @Grab lines. (There may be a way to either enable Maven to not choke, or conditionalize those.)

On Thursday, January 26, 2017 at 10:36:50 AM UTC-8, Mark Hudson wrote:
Given the below ultra-simple test script, I'm trying to figure out how to get junit.xml output.
When I run this, I only get a one-line on-screen summary to STDOUT:
JUnit 4 Runner, Tests: 1, Failures: 0, Time: 71

script:

#!/usr/bin/env groovy

@Grab(group='org.spockframework', module='spock-core', version='1.0-groovy-2.4')  // @Grapes()
import spock.lang.*  // pulls in non-defaults like @Unroll() and @Requires()

class HelloSpockSpec extends spock.lang.Specification {

  def "example single assertion about Spock"() {
    given:  "setup initial data"
      def attrStr = "logical"
    when:   "tweak data"
      def SpockAttr = attrStr
    then:   "assertions"
      SpockAttr == 'logical'
      println "0. PASS: ok -- SpockAttr == 'logical'"
  }

}

// EOF

How can I get junit.xml output? Note I'm not running under Maven or Gradle.

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Loading...