JUnit 5 test case runs, but not in debug mode - java

I have two projects in eclipse. The 3DCoordinates project calculates 3D coordinates and makes the conversion from one to another. The second AstroCoordinates project accesses the first project but defines coordinate systems used in astronomy only.
All the JUnit 5 tests for 3DCoordinates run now without problems. I wrote for the AstroCoordinates in a similar manner a coordinate class called HorizontalCoordinates with the appropriate tests. The tests have still errors when running, but, coming to my problem, when I try to debug them, the test stops after opening the Class.class file.
I searched the Internet, but couldn't find an explanation for this – to me – strange behaviour. Do you know about this issue? What can be the reason for it?
Edit:
Here, you can see the result of the normal test run:
The debug test stops without any error message, after the Class.class file opens.
No error messages occur.

If your class is actually named Class, try renaming it.

Related

Intellij doesn't recognize Groovy tests properly

I have test written in spock. Each time when I'm running tests IntelliJ saying that the configuration is wrong - but if I press apply and etc I'm able to run these tests - What I can do, to don't see these messages?
Example of test for which I'm getting this error message:
The configuration which opens after an attempt of running the test:
Last error message:
Any ideas how to get rid of these?
For now I have created issue.
IntelliJ IDEA JUnit configuration stores method name and parameters signature in a single string instance.
While this works for Java (it doesn't allow parentheses in methods names), this fails for other JVM languages.
This issue is not related to Spock, it's reproducible for arbitrary JUnit test class written in Groovy.
Follow YouTrack ticket for updates.

Some of my tests show prepended with junit.framework

I have a set of junit tests that run automatically on my build server (Jenkins).
I run more than 500 tests. Most of them, in the test results view, show up with the correct package value
Example : results for com.test.app.RollingArchiveTest
But I have 8 tests that have junit.framework prepended to them.
So it would give : junit.framework.com.test.app.RollingArchiveTest
What is really strange is that I see both behaviors in tests that belong to the same package. Some classes are prepended and some are not.
I looked at the code, and founds nothing really obvious. The tests all run using the same command so I would not expect any change there.
I could not really find any information about that on the web.
Would you have any clue what could cause this?
I am not sure if it is relevant, but all the test cases for classes that have junit.framework prepended to them are skipped.
Thanks
Ok, diving deeper I realized that in all the classes I use the Assume statement.
When this assume firing in the #BeforeClass, I end up with the junit.framework.TestSuite prepended.
So the solution would be to avoid Assuming anything in the BeforeClass.

Step into not working in the debugging mode Eclipse

I am working on a project of java. I opened the project in debugging mode, and goes through the program. One thing where I got stuck is that, if I step into a specfic function, it dont go into it. Instead if I put a breakpoint inside that function then program goes upto that point. I am using Eclipse 3.7.2. I dont know why eclipse is showing such a behaviour. Any help will be appreciaed.
dystroy already said in a comment what I was planning to say in this answer: the most common cause for me experiencing this is when the actual runtime class instance is a dynamic proxy, usually from either hibernate, or Spring, or a mock object framework (when testing) such as Mockito. In those cases, you generally have to do exactly what you have done, and put a breakpoint inside the method being stepped into.

NetBeans Test File and Run file diff

In Netbeans after creating program and want to run a file, right click the mouse and two options are enabling,one is Test file and another one is run file. What is the difference, because i get confused so many times.
I guess from your question that you want to code some c++ or java kind of program and you want to run them individually.
So, I suggest you to use special editor for every kind of development.
Netbeans generally used for big developments (but u can use it for a single file as well) and it helps in so many other aspects...(which I suppose you don't require).
In Netbeans, Run may have different meanings depending on the type of project you're working on.
In a Java project, Run file with a green arrow means running the main method of a Java class.
You may even notice that the Run file option is grayed out if a class has not a main method.
In a Web or Enterprise project it means deploying the project to an associated application or web server.
The Test option means running any test cases for an individual file at a time or to an entire project at once. The tests cases are usually created with a Unit Test library like JUnit or TestNG. If you don't know what a unit test is you may like to read this for reference.
I hope it helps.

Integration of System Tests in the build process

I am continuing the development of a serialization layer generator. The user enters a description of types (currently in XSD or in WSDL), and the software produces code in a certain target language (currently, Java and ansi C89) which is able to represent the types described and which is also able to serialize (turn into a byte-sequence) and deserialize these values.
Since generating code is tricky (I mean, writing code is hard. Writing code that writes code is writing code to do a hard thing, which is a whole new land of hardness :) ). Thus, in the project which preceded my master thesis, we decided that we want some system tests in place.
These system tests know a type and a number of pairs of values and byte sequences. In order to execute a system test in a certain language, the type is run through the syste, resulting in code as described above. This code is then linked with some handwritten host-code, which is capable of reading these pairs of a byte sequence and a value and functions to read values of the given value from a string. The resulting executable is then run and the byte-value-pairs are fed into this executable and it is overall checked if all such bindings result in the output "Y". If this is the case, then these example values for the type serialize into the previously defined byte sequence and we can conclude that the generated code compiles and runs correctly, and thus, overall, that the part of the system handling this type is correct. This is a very good thing.
However, right now I am a bit unhappy with the current implementation. Currently, I have written a custom junit runner which uses quite a lot of reflection sorcery in order to read these byte-value-bindings from a classes attributes. Also, the overall stack to generate the code requires a lot of boilerplate code and boilerplate classes which do little more than to contain two or three strings. Even worse, it is quite hard to get a good integration with all tools which base on Junits descriptions and which generate test failure reports. It is quite hard to actually debug what is happening if the helpful maven Junit testrunner or the eclipse test runner gobble up whatever errors the compiler threw, just because the format of this error is different from junits own assertion errors.
Even worse, a single failed test in the generated code causes the maven build to fail. This is very annoying. I like it if the maven build fails if a certain test of a different unit fails, because (for example), if a certain depth first preorder calculation fails for some reason, everything will go haywire. However, if I just want to show someone some generated code for a type I know working, then it is very annoying if I cannot quickly build my application because the type I am working on right now is not finished.
So, given this background, how can I get a nice automated system which checks these generation specifications? Possibilities I have considererd:
A Junit integrated solution appears to be less than ideal, unless I can improve the integration of maven and junit and junit with my runner and everything else.
We used fitnesse earlier, but overall ditched it, because it caused more problems than it solved. The major issues we had were integration into maven and hudson.
A solution using texttest. I am not entirely convinced, because this mostly wants an executable, strings to put on stdin and strings to expect on stdout. Adding the whole "run application, link with host code and THEN run the generated executable" seems kinda complicated.
Writing my own solution. This will of course work and do what I want. However, this will be the most time consuming task, as usual.
So... do you see another possible way to do this while avoiding to write something own?
You can run Maven with -Dmaven.test.skip=true. Netbeans has a way to set this automatically unless you explicitly hit one of the commands to test the project, I don't know about Eclipse.

Categories

Resources