Good morning everyone,
as you can read in the title, I have some serious performing issues with Junit 4.12,ANT (Ant 1.9.2) and Java1.6.0_45.64. I wrote a hole new test framework for my company because the current is messed up.
We are performing continuous integration tests with Jenkins CI, now using Junit 4.12, Ant 1.9.2 and the DbUnit-2.5.1 SNAPSHOT library for DB transactions on our Oracle DB (11g). I am tied to use this libraries/setups because they're are part of my requirements.
So I integrated the new framework to a smaller Project (111 tests) and ran the test suite. From the Eclipse IDE (Mars.1) it took 100s (avg).
Now, so I can integrate to Jenkins, I am writing the ant target. Running the test suite with ant took much longer (~300s). Damnit...
I then rewrote the new framework for using TestNG (the old framework) and ran the ant target. This took only have the time.
I researched for hours on Google and found some configurations for the junit Task, like setting forkmode=once --> nothing changed at all.
I now gave up and I am asking more experienced developers for help. Do you hava any ideas?
Thanks in advance!
Related
Using Intelliji Community Edition 2022.03 on windows 11, working with Maven 3.6.3 and Java-8.
Been experiencing strange issue: I cannot run single Junit||Blueprint test if that test has problem, the IDE always try to build the whole test file and then failed at that single problematic test. So the situation end up being I have to run all the test successfully in order to run single test. I am sure it is related to my local environment, because my colleges have no such problem we have everything the same. and I also have no such problem in linux VM.
I have tried
install unintall different versions of IDE
Modify test to not build before run, works, but if I change code, no auto detection, so barely
Any wise men got some ideas please ?
I am interested in how JDK is tested itself, what test engine it uses.
I found some links:
https://github.com/ddopson/openjdk-test - does not look as official repository
http://openjdk.java.net/jtreg/ - contains regression tests, points to Jonathan Gibbons' blog but seems that it is unavailable
Also, I would like to see how frameworks like Swing and JavaFX are tested.
Are there any manuals / instructions available about how to execute / look through JDK tests?
OpenJDK comes with its own regression test suite.
The tests can be found in the 'test' subdirectory of the individual repositories making up a JDK forest. For example, javax.swing jtreg tests for JDK 9 can be found at http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/tip/test/javax/swing .
These tests are run using the jtreg tool. You can learn more about it here: http://openjdk.java.net/projects/code-tools/jtreg/intro.html
I think the bulk of the tests is still run through jtreg. The tests themselves are part of the OpenJDK source trees stored in Mercurial.
I'd look at distribution packaging for information how to run jtreg. I think the distributions run at least a subset of the test suite as part of the build process. I don't know anything in particular about GUI testing; I have never had the need to look at those.
First time I am trying Junit and I am following below link:
http://www.vogella.de/articles/JUnit/article.html
When I run my testClass as Run-As-> Junit Test. It says below thing.
Please help me in figure it out.
Could not launch the JUnit plug-in tests because project 'SalesTax'
is not a plug-in project.
SalesTax: Is the Project Name
I suspect you did create an Eclipse 'jUnit Plugin Test' launch configuration which is designed to run Eclipse plugins jUnit tests (in some kind of mocked eclipse environment).
Try to create a simple 'jUnit' launch configuration instead.
Suggestion - Follow the tutorial. type in the (3-line) example "MyClassTest" from the tutorial. Verify that you can get the tutorial working. Post back with any questions about the tutorial.
Once you get one complete example working, end-to-end (your code, your JUnit test code, and successfully building and executing at least one JUnit test in your IDE), then try to get your "SalesTax" project working.
Q: I presume you're using Eclipse, correct? Eclipse 3.7?
PS:
Here's another good tutorial:
http://www.ibm.com/developerworks/java/tutorials/j-junit4/
The JUnit integration with eclipse is very nice. However, I would like a feature to be able to generate a quick report from the Unit Tests. It is possible to do so when running a headless build (and my nightly build is configured to do so), but sometimes I want to generate a report from the UI.
Is there anyway to do this? command line options maybe? an extra plugin? maybe the functionality is already there and I can't find it?
EDIT: I have a PDE build, as my project is an RCP application. Thus, running the tests from this build is not really straight-forward. I guess I could try to hack a smaller ANT script to do the test, but then probably I have to fight with the classpath to obtain what I want. I was hoping to find some extension to the already existing JUnit plugin that would provide the information on the tree view, but as an HTML document.
You can use ant and generate HTML report [I think you can use Ant in Eclipse]
I found these link but you can survey more:
Ant JUnitReport Task
JUnit Tutorial
JUint Report
I'm not sure if you want a "physical" report that you can distribution or just more information you can view in your IDE.
Either way I agree with SjB's advice on configuring Eclipse to run the ant script generating the report in your nightly build.
If it's not possible to run the nightly build locally, you can do some very simple build script hacking following the links in SjB's answer.
You also might want to check out the Ant JUnit Task Manual Page
I would like to run Atlassian Clover in a production environment (I don't have an issue with overhead ). Does anyone have experience with this, or can you direct me how to do it?
My goal is to get clover reports based on real users actions. I'm using JBoss + JDK 1.5
You can deploy clover build (along with the coverage.db files generated during the instrumentation) to your servers, add a bunch of clover-specific java options to set it up and then collect the results, merge them using the clover merge tools and generate the reports. See Clover Wiki for detailed instructions.
Please note that by default, clover dumps the coverage data upon process termination - you might want to do some research on how to make it happen periodically. Look into -flushpolicy and -flushinterval options.
found the answer finally , thanks all .
after I created the Clover DB ( cmd / or eclipse integration ) , while starting my App server I add the following params
-Djboss.shutdown.forceHalt=false -Dclover.initstring.basedir=/coverage.db
it will do the job
The general strategy would be to use Clover (or Cobertura or a similar tool) when you compile your web application. If you use maven for doing your builds, you can use the cobertura plugin:
http://mojo.codehaus.org/cobertura-maven-plugin/instrument-mojo.html
To add this easily with the cobertura:instrument goal. You then drop the generated war into JBoss just as before.
You'd probably also be interested in Glassbox:
http://www.glassbox.com/glassbox/Home.html
It doesn't generate code coverage, instead it gives you a high-level report at what's going on and can tell you where you may have bottlenecks.
I haven't used clover in a long time... but I do use cobertura (http://cobertura.sourceforge.net/faq.html) for code coverage. Looking at the FAQ for cobertura it does work with JBoss.