Junit Test with Jazz, how?
Hi @all,
Junit Test: * I saw some hints and screendumps how to include Junit Test in Jazz. Jazz Wiki showed some examples inside CodeCoverage * But the "ToDo" it is not really clear for me. Questions: * Where is the starting point? * Should I include the Junit Tests in the build (build properties)? * Is it the "run.coverage", "run.test" property? * How to I include the results? Thanks in advance Stefan |
11 answers
Hi Stefan,
It is not clear to me what you want when you say "JUnit test in Jazz". If you are talking about seeing JUnit results within build results for your automated builds, I can point you to the following: Getting started with Jazz Builds https://jazz.net/learn/LearnItem.jsp?href=content/docs/build-setup/index.html There is also a concrete example of a build script that publishes compile and JUnit results to Jazz. You will find it where you installed the TeamConcert client at this path: /jazz/buildsystem/buildtoolkit/examples/compile-and-test Hope this helps, Ryan |
Hi Ryan,
thanks for your hint... Result: * Junit and other things like "download" work in the buildresults * Codecoverage not (a log4j problem?) Question: * It seems that the build.xml is important ==> a normal build.xml must be manually changed? Regards, Stefan |
Hi Stefan,
Getting code coverage results in your build results takes a little extra work. We understand there is a need for a code coverage example. There is a work item for it. I would suggest subscribing to work item 26371 to follow along. https://jazz.net/jazz/web/projects/Jazz%20Project#perspective=Work%20Items&action=viewWorkItem&id=26371 |
Hi Ryan,
is there a way to help you ? (or with the work item?) Regards, Stefan |
Hi Stefan,
My advice is to ask the owner of the work item, in a work item comment. |
I am looking at adding automated testing to our RTC automated build.
We were able to run the following example in https://jazz.net/wiki/bin/view/Main/AntBuildCompileAndTest - This is a simple example using the Ant option - Is there anything that shows an eclipse product being tested with some junit tests located in separate plug-in projects? Our current build is using the SCM Command Line Interface option We did put in a <junit> section in one of our current steps and was able to run a test, but we have a couple problems - How do we include the product classpath that was used for the build since the build used the product definition I assume to create the classpath - Can we specify our junit eclipse launcher so we can include some environment options and vm arguments that influence the testing |
If you want to run JUnit tests within the context of a running Eclipse instance, you do so by running an eclipse application that runs the tests you want. This lets Eclipse/OSGi bootstrap everything as it normally does, then runs the tests within that context.
The test runner applications are in the org.eclipse.test plug-in, which you'll need to include in the eclipse target that you're testing (or copy it in as part of the build script). The org.eclipse.test plug-in is found in the "JUnit Plugin Tests and Automated Testing Framwork" section of the Eclipse downloads page, named eclipse-test-framework-<version>.zip. Its plugin.xml defines 2 application extensions: org.eclipse.test.coretestapplication and org.eclipse.test.uitestapplication. The first is headless (tests run directly with no UI), the latter runs with the workbench UI (tests run in the UI thread after the workbench is up and running). The library.xml file in that zip provides some Ant tasks to invoke these applications. The testframework.html in that zip provides some doc. You can read it directly here: http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.test/testframework.html?view=co Hope this helps, Nick |
I have a plug-in (e.g. com.ibm.hello.tests) which contains all JUnit testcases for another plug-in(e.g. com.ibm.hello). How can I automate the build process so after com.ibm.hello.tests is compiled, it automatically run the testcases and show reports. Both plug-in here are "native" components. What I need to add in build.xml to enable this automation? My env. is CCB/RTC.
Thanks. |
The example here shows how to use PDE Build to build plugins, run tests against the built plugins using the Eclipse test framework, and publish results using the Build Toolkit Ant tasks (like jdtCompileLogPublisher and junitLogPublisher).
https://jazz.net/wiki/bin/view/Main/BuildFAQ#PdeBuild Some key excerpts are: In buildfiles/buildAll.xml:
In buildfiles/test.xml:
In org.eclipse.team.tests.core/test.xml:
In buildfiles/library.xml (copied and modified from the Eclipse test framework):
Note the use of the XMLJUnitResultFormatter (from Ant) to output the JUnit results in an XML file that can be parsed by RTC's junitLogPublisher task. |
thanks for the reply. I have been playing with similar stuff found from google search, but can not get it work. I try to add one more block in our build.xml which is the component build script to do CCB build(ours test component is a native component so we create our own build.xml to do the CCB build). In build.xml, it goes thru. clean, init, compile, run_junit_plugin_tests, dist(to jar plug-in)and build(zip the jar). The following is run_junit_plugin_tests which try to combine test.xml and library.xml together.
My question are these: 1. is it(combine everything all together)workable? 2. where should be "dir" when running this target? currently, I put ${jazzWorkspacePath}\component, is this ok? or it should be C\timestamp\component? 3. what's classpath and workspace should be when running this run_junit_plugin_tests? Currently by running the build.xml, it fails with Error Processing: org.eclipse.equinox.internal.p2.extensionlocation.SiteListener@478f478f: java.lang.NumberFormatException: For input string: "0_v20100816_1317" java.lang.Exception: Could not find plugin "com.ibm.nex.console.web.server.tests" <target> <classpathref> --> <property> <java> <classpath> <fileset> <include> <include> </fileset> </classpath> <arg> </java> </target> |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.