testng

Does @Test(enabled = false) work for a class in TestNG?

From the TestNG doc I can see that (enabled = false) can be applied to a class or method. But it seems it only works when applied to a method. Anybody seen the same, found a solution? I'm running tests in ItelliJ IDEA 7.0 by the way. ...

How to execute JUnit and TestNG tests in same project using maven-surefire-plugin ?

Right now I have both type of tests but when I say "mvn test" it only executes TestNG tests and not Junit. I want to execute both one after another. Any Idea ? ...

JPA-based JUnit Test Best Practices

This is a bit of an odd question, but it has been bothering me for a few months now. I have built a JPA-based web application using Wicket + Hibernate (built with Maven), and want to test the DAO layer directly. I created a specific src/test/resources/META-INF/persistence.xml file that I used for testing, but have been running into confl...

Junit4 and TestNG in one project with Maven

To run them together there are few options available but I have chosen using different profiles for Junit and TestNG. But now problem is with excluding and including test cases. Since if we add testNG dependency to main project in maven it will skip all Junit,I have decided to put it in separate profile. So I am excluding TestNG tests ...

How to change TestNG dataProvider order

Hi, I am running hundreds of tests against a large publishing system and would like to paralellize the tests using TestNG. However, I cannot find any easy way of doing this. Each test case instanciates an instance of this publisher, send some messages, wait for those messages to be published, then dump out the contents of the publish qu...

How to create structured automatic testing with selenium (junit or testng)? What is your best practice for this?

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 -- ...

How can I identify the Selenium Grid host running my test from within the test?

I am using Selenium Grid with TestNG to run my tests in parallel. I have certain tests that require a user to be logged in, so I have a user account configured for testing. I have been careful to ensure that any tests involving logging in as my test user are run on separate virtual machines so that sessions are not interrupted, however ...

Why is Maven failing with a SurefireExecutionException: > Cannot set option parallel with value

Hi I am working through the tutorial here using windows XP and latest builds http://binil.wordpress.com/2006/12/08/automated-smoke-tests-with-selenium-cargo-testng-and-maven/ Could someone please tell me what the tags are. <parallel>true</parallel> <threadCount>10</threadCount> When I build with these tags included I get a failure:...

Java unit test coverage numbers do not match.

Below is a class I have written in a web application I am building using Java Google App Engine. I have written Unit Tests using TestNG and all the tests pass. I then run EclEmma in Eclipse to see the test coverage on my code. All the functions show 100% coverage but the file as a whole is showing about 27% coverage. Where is the 73% unc...

TestNG and Spring 3

Hi guys, What is the best practice way to do unit testing with Spring? I assume the combination TestNG & jmockit with Spring 3 isn't bad, so that's what I'm doing right now, but if I'm off course selecting the tools for my fresh Spring project, please tell me right away. :-) Anyways, I've created an entity that I want to test, but I'm n...

LazyInitializationException while unit-testing Hibernate entity classes for use in Spring, using TestNG

Hi guys, In my Spring configuration, I've asked that the session should remain open in my views: <bean name="openSessionInViewInterceptor" class="org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor"> <property name="sessionFactory" ref="sessionFactory"/> <property name="flushMode" value="0" /> </bean> ...

TestNg, annotation "beforeTestMethod" and override

For my tests I'm using a base class MyTestBase defining a method setup() that does some base preparations: public class MyTestBase { @Configuration( beforeTestMethod=true ) protected void setup() { // do base preparations } } Now I have some more specific test classes that have to do their own preparations. There a...

Spring3/Hibernate3/TestNG: some tests give LazyInitializationException, some don't

Dear Sirs, The preface: I'm struggeling with LazyInitializationException in my Unit Tests, and I have a really hard time getting my head around it, as you can see from my questions Database Sessions in Spring, TestNG and Spring 3 and LazyInitializationException while unit-testing Hibernate entity classes for use in Spring, using TestNG...

Is there a log4j appender that connects with TestNG?

I use log4j and would like log messages that normally end up in my logging facility to appear in the test reports created by TestNG during my unit tests. I think that would mean a log4j Appender which outputs to a TestNG Listener and an appropriate log4j config in the src/test/resources directory of my Maven project. Is that correct? I...

How to execute one test from large TestNG suite using testng.xml?

I have a TestNG suite with large amount of methods. I execute this suite using wrapper built on top of TestNG runner. All tests in the suite fail except one. What should I write in testng.xml to execute just that one failed test? Obvious solution is to assign unique group names to all of the methods and then specify name in testng.xml. ...

How can I test a .class file was created?

I want to unit test my code which will have to create a .java file compile it and then the corresponding .class file should be created. How can I create the test to see if the ".class" file is created? I have added test already for its existence, now I'm trying to test the file is a valid class file. I tried try { Class.forNam...

Putting array of arrays into a spring context

I just found a TestNG test case that uses Spring to provide its data source. As a result the code is quite clean and concise. However, I need to expand the test cases so they can take a variable list of inputs. Am I stuck using bean references for the list of lists as I've attempted below? Is there a way to do that and still be prett...

TestNG + Selenium woes. noClassDef error, TestNG based selenium test

Hello, I've followed a lot of the guides and forum posts online but haven't had any luck getting this to work inside TestNG. It's a selenium grid based test, programmed in eclipse. Had trouble, so used the libraries listed in the suggestion of this forum post: http://clearspace.openqa.org/message/66867 I am trying to run the suite in t...

How to test that observer of org.jboss.seam.postInitialization works correctly

Hi I've created SEAM component which checks that at least one user with global admin rights exists and creates one if no. @Name("installer") @Stateless public class InstallerBean implements Installer, Serializable{ @Observer("org.jboss.seam.postInitialization") public void install() { ... } public boolean isInstalled...

TestNG + Selenium Grid, only one RC running,

I am using Selenium Grid with TestNG to test a website. The test-code, that i exported from the Selenium IDE works fine. My problem is, the tests are running sequential, not parallel. Here is the code: public class test{ @BeforeMethod public void startSession() { ThreadSafeSeleniumSessionStorage.startSeleniumSession("localhost",44...