DISQUS

Software Is Insane: How to run Groovy unit tests in Netbeans

  • dma · 9 months ago
    Forgot to mention that you needn't to override "-post-test-run" in that case.

    Also, what is the tag for code? I suck at posting :(
  • pstehlik · 9 months ago
    Why do you think that you don't need to override -post-test-run?

    If you are talking about how to include code highlighting in your blog/website, check out http://alexgorbatchev.com/wiki/SyntaxHighlighter
  • dma · 9 months ago
    Sorry, I replied to my own post and my original post vanished. You don't need to override -post-test-run if you override -init-macrodef-junit. Like this, for example:

    <target name="-init-macrodef-junit">
    <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
    <attribute default="${includes}" name="includes"/>
    <attribute default="${excludes}" name="excludes"/>
    <attribute default="**" name="testincludes"/>
    <sequential>
    <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
    <batchtest todir="${build.test.results.dir}">
    <fileset dir="${build.test.classes.dir}">
    <include name="**/*Test.class"/>
    <exclude name="**/*$*"/>
    </fileset>
    </batchtest>
    <classpath>
    <path path="${run.test.classpath}"/>
    </classpath>
    <syspropertyset>
    <propertyref prefix="test-sys-prop."/>
    <mapper from="test-sys-prop.*" to="*" type="glob"/>
    </syspropertyset>
    <formatter type="brief" usefile="false"/>
    <formatter type="xml"/>
    <jvmarg line="${run.jvmargs}"/>
    </junit>
    </sequential>
    </macrodef>
    </target>

    This way our java tests won't be run twice. Just my two cents
  • pstehlik · 9 months ago
    thanks for the hint!
    will try that one out.
  • dma · 8 months ago
    I asked whait is the tag for code, if it even possible to use it inside comments. All my comments with xml listings just disappear.

    You can override -init-macrodef-junit the same way you overrided -post-test-run. Your java tests won't run twice in this case.
  • Vanessa Williams · 8 months ago
    Thank you for this. You saved me a great deal of time. Cheers.
  • jgs · 7 months ago
    Helped me, worked fine. Thanx
  • cowabunga1984 · 5 months ago
    Hmmm, the download-link does not work :)
  • miti · 2 months ago
    This post was real helpful. Thanks.
  • miti · 2 months ago
    This post was real help. Thanks