junit

How to develop a Nightly Builder

Hello, I was told to create a tool like a Nightly Builder for a JUnit project. It's a client-server project with oracle database.The tests are based on QTP. Also there is a test interface written on C#. The tester can click on the interface to choose which tests to run and get a report from each test. So I have to make this procedure aut...

How to create a database deadlock using jdbc and JUNIT

I am trying to create a database deadlock and I am using JUnit. I have two concurrent tests running which are both updating the same row in a table over and over again in a loop. My idea is that you update say row A in Table A and then row B in Table B over and over again in one test. Then at the same time you update row B table B and...

error while opening browser with selenium RC using JUnit

I am getting following error while opening browser with selenium RC using JUnit. Plz help. com.thoughtworks.selenium.SeleniumException: XHR ERROR: URL = http://www.google.com/ Response_Code = 403 Error_Message = Forbidden at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97...

class weblogic.management.WeblogicMBean not found

Hi all I meet this problem when I try to run Junit test case in fork mode (starting each test in a separate JVM) using Build ant file. [junit] Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/management/WebLogicMBean [junit] at java.lang.ClassLoader.defineClass1(Native Method) [junit] at java.lang.ClassLoader.defineC...

Does TestNG has runner like SpringJUnit4ClassRunner

Hi, When I write tests in JUnit (in Spring context) I usualy do it like this: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:testContext.xml") public class SimpleTest { @Test public void testMethod() { // execute test logic... } } How can I do the same with TestNG? ...

How can I get JavaDoc into a JunitReport?

Hi - I'm a tester, with some Java and plenty of bash coding experience. My team is building an automated functional test harness using JUnit 4 and ant. Testers write automated tests in Java and use JavaDoc to document these tests. We're using ant's JunitReport task to generate our test result reports. This works superbly for reporting...

JUnit confusion: use 'extend Testcase' or '@Test' ?

I've found the proper use (or at least the documentation) of JUnit very confusing. This question serves both as a future reference and as a real question. If I've understood correctly, there are two main approaches to create and run a JUnit test: Approach A (JUnit 3-style): create a class that extends TestCase, and start test methods w...

Why is my test not running

Strangest thing happened my test was running ok and now its not anymore I didn't change the code at all here is the exception : Class not found com.example.test java.lang.ClassNotFoundException: com.example.test at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method...

Junit test for message driven bean (using jboss application server)

Hi, I am facing the problem when run the junit test case for the MessageDrivenBean(here i am using jboss application server). That is "org.jboss.jms.exception.MessagingJmsException:Failed to invoke". How can overcome this. ...

In netbeans when I run my junit test it works fine, but when I debug the test it throws NoClassDefFoundError

In netbeans when I run my junit test it works fine, but when I debug the test it throws NoClassDefFoundError saying it can't find javax.servlet.jsp.tagext.bodytagsupport Anyone know what could cause this? ...

Junit test that creates other tests

Normally I would have one junit test that shows up in my integration server of choice as one test that passes or fails (in this case I use teamcity). What I need for this specific test is the ability to loop through a directory structure testing that our data files can all be parsed without throwing an exception. Because we have 30,0...

Junit 4 custom test class description

I am using the @Parameterized annotation to run a test class over and over again against different test files. The problem is that in my IDE/build server the tests show up as "MapSimulationTest" 0-x. How can I have a method that provides JUnit 4 with a custom name for each instance of my MapSimulationTest class? In this case it wou...

Running a JUnit4 test - from a java program

I was wondering how to run some JUnit4 test inside a java program. Basically - depending on some conditions during runtime I need to decide which test runner to use. Using Junit3 I could override runTest method from TestCase class - but in JUnit4 tests do not extend TestCase class so I have nothing to override... Is there maybe some meth...

structural coverage of java code

hi, do you know if there is any tool which makes structural coverage of java code? did Junit do this ? any links,documenetation which could help me? thanks ...

Can a JMock mock object return another mock object?

I'm writing tests for an application using the iBatis DAO framework. The app is running in a java 1.4 environment, so I'm using legacy versions of everything (JDK 1.4, JUnit3, iBatis 2.3 and JMock 1.2). In my MockObjectTestCase subclass I have this test public void testInsert() throws Exception { Mock mockDao = mock(TblPpvFiltersD...

How to add a spring application context to the java runtime to be used for integration tests within eclipse?

I am trying to add a test spring application context to the java runtime, so that my beans can be wired properly for my integration tests. ...

Choose order to execute JUnit tests

Hi! I wanted to choose the order to execute the JUnit tests. I have 4 classes with several test methods in it, my goal is to execute, for instance, method Y of class A, then method X from class B, and finally method Z from class A. Would you help please? ...

How to inject ServletContext for JUnit tests with Spring?

Hi I want to unit test a RESTful interface written with Apache CXF. I use a ServletContext to load some resources, so I have: @Context private ServletContext servletContext; If I deploy this on Glassfish, the ServletContext is injected and it works like expected. But I don't know how to inject the ServletContext in my service class...

Layout of Ant build.xml with junit tests

In a project I have a folder src for all application source code and a different folder test for all junit test (both with a simular package hierarchy). Now I want that Ant can run all tests in in test folder, bot the problem is that now also files in the src folder with "Test" in the filename are included. This is the test target in ...

Maven Spring tests fail when run together, but succeed individually (ehcache closed, IllegalTransactionStateException)

We're using Maven/Surefire and Spring/Hibernate transactional tests for a fairly large web application. There are 138 Test* classes, running a total of 1178 tests. A straightforward "mvn test" will generate 82 errors, the nature of which tend to imply a corrupt application context: Many of these: IllegalTransactionStateException: Pre-b...