I'd like to know if there are some unit testing frameworks which are capable of writing multi-threaded tests easily?
I would imagine something like:
invoke a special test method by n threads at the same time for m times. After all test threads finished, an assertion method where some constraints should be validated would be invoked.
My...
I would like to create a junit test suite using JUnit 4 where the names of the test classes to be included are not known until the test suite is run.
In JUnit 3 I could do this:
public final class MasterTester extends TestCase
{
/**
* Used by junit to specify what TestCases to run.
*
* @return a suite containing what TestCa...
Hi. i am trying to run and publish my junit tests in html using a build.xml file calling the junit target but it doesnt seem to work.
here is how my build.xml looks like:
<target name="Unity Agent SDK Test ">
<mkdir dir="${junit.output.dir}" />
<echo message="making directory" />
<junit fork="yes" printsummary="yes">
...
We have a bunch of classes that listen for events from the server and then respond to them. For example:
class EventManager {
private Set<Event> cache = new HashSet<Event>();
private EventListener eventListener = new EventListener() {
void onEvent(Event e) {
if (e instanceof MyEvent || e instanceof YourEvent) ...
Hi, im using Junit with spring-test and i would like to have a classic transactionnal test with this annotation:
@Injectdata("classpath:src/test/mydata.sql")
@Test
public void myTest throws Exception{
...
}
This data will be injected with the jdbcspring template in the same transaction & those datas will be available for
only this test...
I followed the online directions for building HelloAndroid and HelloAndroidTest in Eclipse. The test runs, the logcat shows the correct results going to stdout, but the JUnit testrunner window in Eclipse is silent - nothing.
I am running the test on a Nexus One with Android 2.2 installed via OTA. I've been unable to find any mention of ...
I am using JUnit 4, Maven 2 and latest Eclipse. Problem is simple: I would like to perform some setup (connecting to a database) before my tests are executed.
I tried @BeforeClass in many different locations but Eclipse and Maven are ignoring this. Any help on accomplishing this initial setup?
Thanks!
public abstract class BaseTestCas...
I've written my own Android ContentProvider for accessing certain Internet resources. I'm trying to write some unit tests, but I do not want those tests to actually access the Internet.
Behind the scenes, my code is using the DefaultHttpClient class to access the web. Basically, I'd like to know how I can use the ProviderTestCase2 cla...
I'm trying to write a JUnit test for a Spring Roo project. If my test requires use of the entity classes, I get the following Exception:
java.lang.IllegalStateException: Entity manager has not been injected
(is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)
The Spring Aspects JAR looks to be configured correctly....
When i use Junit's org.junit.rules.Timeout with spring's base class AbstractTransactionalJUnit4SpringContextTests, i get this exception:
org.springframework.dao.InvalidDataAccessApiUsageException: no transaction is in progress; nested exception is javax.persistence.TransactionRequiredException: no transaction is in progress
The log ou...
Is there a way in junit to test rowlocked exception?
...
My eclipse workshop keep terminating on me while in the middle of test run or just navigation. Below is the error property i keep getting. Can anyone help stop this nightmare. Thanks
=====
JVM terminated. Exit code=1
C:/bea/jdk150_11/jre/bin/javaw.exe
-Xms384m
-Xmx768m
-XX:MaxPermSize=256m
-Dweblogic.home=C:/bea/wlserver_10.0
-Dosgi.ins...
One of the JUnit best practices is : same package, separate directories. I am wondering what is the equivalent for Mock classes ? Do you keep them in the same package as classes they are supposed to mock, but in the test directory ? or elsewhere ?
...
How can I tell my modern Eclipse (Galileo, Helios) that all unit tests in my workspace (or anywhere) are written in JUnit 3 and so I would like them to be run with this older JUnit version?
I am talking about project/workspace/system default. Not a single specific test suite. I need it to use JUnit 3 by default for all these tiny 10-ca...
I am trying to get some basic unit tests up and running on the Play! framework using the Siena persistence library with GAE as the intended deployment target.
I have the project configured properly and can deploy the app to GAE. I created a basic domain object:
public class User extends Model {
@Id(Generator.AUTO_INCREMENT)
pu...
Possible Duplicate:
Whats the best way of unit testing private methods?
I am a beginner programmer, and I don't know how to write an application that will be well structured for unit testing. I want to write applications with the ability to afterwards add effective unit tests.
The problem is with private methods - they can't ...
Hi,
Does reflection breaks the idea of private methods, because private methods can be access outside of the class? (Maybe I dont understand the meaning of reflection or miss something else, please write)
http://en.wikipedia.org/wiki/Reflection_%28computer_science%29
Edit:
If relection breaks the idea of private methods - does we use p...
As you know, exception is thrown at the condition of abnormal scenarios. So how to analog these exceptions? I feel it is challenge. For such code snippets:
public String getServerName() {
try {
InetAddress addr = InetAddress.getLocalHost();
String hostname = addr.getHostName();
return hostname;
}
c...
Does HttpUnit support getting a response from an HTTP POST with an xml argument?
Edit
If you want to send a post request, you might instantiate a PostMethodWebRequest object.
WebRequest request = new PostMethodWebRequest("http://example.com/thing/create");
And if you want to set parameters for that request, I think what you would do...
The spring framework documentation states:
In the unlikely case that a test may
'dirty' the application context,
requiring reloading - for example, by
changing a bean definition or the
state of an application object -
Spring's testing support provides
mechanisms to cause the test fixture
to reload the configurations and...