I know that unit testing is desirable, and I am interested in doing unit testing. The only problem is I have no idea how, or even where to start really. So my question is: How do I learn about and start unit testing? Specifically I frequently write Java code in NetBeans and C# code in Visual Studio and am interested in what tools to u...
I have some test infrastructure classes that I'd like to add as listeners of JUnitCore , specifically for testRunFinished.
I'm invoking Junit 4 from ant's task.
Is there some way for me to get access to the JUnitCore created by the task so that I can add a listener?
...
This is a "design/architecture" question and so you don't need to provide me technical details.
I can find examples on the internet all day long that show how to run a xunit unit test, log test results, and how to show if it succeeds or fails but every example on the internet is hard coded and nobody shows examples of how you store your...
I have a NetBeans project set up with a bunch of source classes and about 10 jUnit test classes in a separate Test folder.
From within the Test files I can import any other test file or source class. However, from within the normal source files, NetBeans acts as if the Test classes don't exist. Autocomplete on them won't work, and if I ...
I have an eclipse project where every source folder has its own associated output folder. Instead of /classes it's called /eclipse-classes.
So if I have a folder:
src/main/java (typical maven thing)
the target folder is:
target/eclipse-classes
And likewise for resources etc.
This seems to work (i.e. eclipse generates .class files tha...
I have written tests that are using selenium for functional testing. I'm using Java. I would like to be able to create structure between tests. Is it possible to do it with jUnit or TestNG?
Would like to be able to create test structure that will produce report like this:
Top test FAIL
- Module1 test PASS
-- Module1Class1 test PASS
-- ...
I have a project that builds with maven2 and runs a series of JUnit test cases against the code. This has worked fine up until this point, where I now have 2 tests that must run in a certain sequence for things to work correctly, let's say TestA and Test (A then B). Unfortunately, maven2 doesn't understand this, so I'm looking for a wa...
I've spent a few hours searching for this, and can't find it, so I'm asking. Why here?
How can I customize Eclipse so that when I create a new JUnit test class or method, it includes different items? For other source, I'd just go into Window->Preferences, and change the templates.
But for JUnit, that doesn't seem to be possible.
I...
Hi all,
I've got the following Test-class, but it doesn't matter what I set as "ContextConfiguration-locations" - it never set my UserService. And it doesn't throw any error when I set a non-existing file in the locations-property... what am I doing wrong?
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "cla...
Hi all,
I'm currently re-using JUnit 4 tests from another project against my code. I obtain them directly from the other project's repository as part of my automated Ant build. This is great, as it ensures I keep my code green against the very latest version of the tests.
However, there is a subset of tests that I never expect to pass ...
I've created some business classes using OO Perl and I want to make sure I don't break them when I change the code. Sounds like unit testing is the way to go.
Is there anything like jUnit for Perl?
Feel free to elaborate on how you've implemented unit testing in Perl projects.
...
I am trying to trouble shoot a JUnit. In the source code, I have set break point in two places: 1) in a line where a static member is initialized 2) the first line of one of the test cases.
The debugger stops in the static field initializing line. But it doesn't stop in the test case. No matter where I set the break point in the test ca...
I've been trying to understand how to start writing and running JUnit tests.
When I'm reading this article:
http://junit.sourceforge.net/doc/testinfected/testing.htm
I get the the middle of the page and they write, "JUnit comes with a graphical interface to run tests. Type the name of your test class in the field at the top of the win...
I used Eclipse to build a pretty simple Java project. It builds and runs in the IDE. I have a few unit tests I wrote using JUnit. They all build and pass in the IDE.
My project is in the following path:
/home/vg1890/workspace/project/
The main source is in:
/home/vg1890/workspace/project/src
And the tests are in:
/home/vg1890/...
Basically I need the opposite behaviour of the @Test(timeout=X) annotation.
The problem I want to solve is to detect in some way that the method never ends (as a right behaviour). I am assuming that if the method didn't stop after X seconds, I am sure "it will never end".
Thanks!
...
I am using powermock 1.2.5 to perform a class that saves data into Oracle database. When I run my test my unit test fails with the following exception:
NoSuchAlgorithmException : DES Algorithm can be found.
After debugging the code I found out that this exception is thrown when my application is trying to set the password to establish...
Hello,
in our web-app project, we include some jar files. For patching some issues of one of the classes in a jar file, we changed the implemention of this class in a patches source folder.
Since there is a defined class loading order in tomcat (WEB-INF/classes before WEB-INF/lib), the patched version of the class is loaded by tomcat, ...
I've been searching high and low for an Eclipse feature that lets you right-click on a main source class and find the corresponding JUnit class(es), without me having to navigate through the test classes of my project. I am using Mylyn which helps reduce the clutter but it would be much easier if there was a feature that performs a find ...
I get this error while running selenium RC tests against IE7.
com.thoughtworks.selenium.SeleniumException: ERROR: There was an unexpected Alert! [error:[object Error]]
It happens whenever I attempt to click a link or a tab or anything clickable. Any Ideas guys. This is really frustrating.
...
I quote this post from exubero's entry. I think this entry will benefit everyone who is doing a unit test:
There are a large number of different methods beginning with assert defined in Junit's Assert class. Each of these methods has slightly different arguments and semantics about what they are asserting.
The following shows some irr...