testng

Junit vs TestNG

At work we are currently still using Junit3 to run our tests. We have been considering switching over to Junit4 for new tests being written but I have been keeping an eye on TestNG for a while now. What experiences have you all had with either Junit4 or TestNG and which seems to work better for very large numbers of tests. Having flexibi...

Can I specify a class wide group on a TestNG test case?

I have a base class that represents a database test in TestNG, and I want to specify that all classes extending from this class are of a group "db-test", however I have found that this doesn't seem possible. I have tried the @Test annotation: @Test(groups = { "db-test" }) public class DBTestBase { } However, this doesn't work because...

What do you need from a test harness?

I'm one of the people involved in the Test Anything Protocol (TAP) IETF group (if interested, feel free to join the mailing list). Many programming languages are starting to adopt TAP as their primary testing protocol and they want more from it than what we currently offer. As a result, we'd like to get feedback from people who have a ...

Eclipse plugin for TestNG coverage

Does anybody know about a Eclipse plug-in to analyze code coverage for TestNG unit tests? Matthias Zerau ...

running multiple TestNG testcases from a single testcase

I have the following situation: I create a class with a single test method, within this test method, I create another class that contains multiple test methods. The report shows only my initial test method, it passes IFF it passes and all the tests in the other class pass. What I wish would happen is the report would contain my first...

Timing out tests in TestNG

Thanks to a library upgrade (easymock 2.2 -> 2.4), we're having tests that have started locking up. I'd like to have a time out on individual tests, all of them. The idea is to identify the locked up tests - we're currently guessing - and fix them. Is this possible, preferably on a suite-wide level? We have 400 tests, doing this each me...

How to use Maven Surefire plug-in with different groups for test and integration-test?

I want to use testng with the Surefire plug-in of Maven. The idea is to tag some tests with a group integrationTest and run the plug-in twice: for goal test excluding the group integrationTest and for goal integration-test including the group integrationTest only. I found some material for running the plug-in for both goals and that wor...

TestNG, multiple suites, possible to merge reports?

So here's an issue at my work. I've got a few testng cases that, if run within the primary batch of test cases, wreak havock throughout the other test cases. Rather than going through and changing all our test cases, I've made a group for the involved cases. I run the main test suite, excluding that group, and then make a second ant call...

Possible to pass parameters to TestNG DataProvider?

We would like to run some of our tests each against a set of data values, verifying that the same conditions hold true for each. The data is currently stored in either flat files or in simple Excel spreadsheets. My first thought was to create a TestNG DataProvider that would load the data from the file and be used to call the test meth...

Possible to use TestNG DataProvider AND test suite Parameters?

Does anyone know if there is a way to use a TestNG DataProvider with a test at the same time as using the @Parameter annotation? Our test suites have some constant configuration information that is being passed to the test methods via the @Parameter annotation. We would now like to use a DataProvider to run these tests over a set of da...

How do I use TestNG with Apache Ivy?

I tried to use TestNG with Apache Ivy, but was unsuccessful. Here is my ivy.xml: <ivy-module version="2.0"> <info organisation="me" module="myproject"/> <dependencies> <dependency org="org.testng" name="testng" rev="5.8" /> </dependencies> </ivy-module> This fails to actually download a TestNG jarfile. It seems to...

selenium rc with cruise control - testng error message - could not instantiate 'test'

I'm currently trying to set up cruisecontrol to run my selenium test suite. Everything works fine until I run the build, I got the following message: calling target(s) [execute-test] in build file C:\Project\src\build.xml Entering C:\Project\src\build.xml... Exiting C:\Project\src\build.xml. task location="C:\Project\src\build.xml:30: "...

how to grab text on a html page using selenium and store the value in testng report and show it on cruisecontrol

I watn to grab the version # of my app (which shows on the first page), and then show it on my cruisecontrol report. Should I use storeText or storeValue? And do I need to reconfig the cruisecontrol xsl? Thanks. ...

What is the best way to write a test case for RESTLET web services?

I have a JAX-RS web service implemented with Restlet library and now I want to test it. In order to do that I'd like to host this service in my test by preinitializing it with mocked services. What is the best way to host such a service and execute the test calls? @Path("/srv") public class MyService { @GET public void action(@Co...

What is the best way to write a test case for JERSEY web services?

I have a JAX-RS web service implemented with Jersey library and now I want to test it. In order to do that I'd like to host this service in my test by preinitializing it with mocked services. What is the best way to host such a service and execute the test calls? @Path("/srv") public class MyService { @GET public void action(@Con...

how to change cruisecontrol head.xsl to reflect value dynamically from testng

Currently I can hard code the header.xsl in cruisecontrol to show anything I want (e.g. browser type), but I'd like to also see the version of my app testng is running against. The version number is situated on the first page of my app under a div class. Is there a way to have cruisecontrol set the value into the header.xsl from grabbing...

In TestNG in @AfterMethod how can I know the test result?

Hi! I have a number of TestNG test classes that all extend one base class AbstractIntegrationTest. In the superclass I have a mehod commonAfterMethod which is invoked after each test method and performs some clean-up. What I want is to do in this method something depending on the test result, e.g. if the test fails, I want to dump the ...

Mixing Hamcrest and TestNG

Has anyone integrated Hamcrest with TestNG so that its matchers can easily be used in TestNG assertions? ...

testNG tests extending BaseTest

Hello, We noticed that when testNG test cases extend TestCase (JUnit) those tests start executing as Junit tests. Also, I should probably mention, the tests are run through Maven. Is this a bug or a feature? Is it possible to override this behavior and still run those types of tests as TestNG tests? Do you know a link where TestNG talk...

How to get Selenium and TestNG to open one browser to run tests in multiple classes

I am using Selenium with TestNG to test a website. I have created tests using the Selenium IDE and exported them to TestNG with each test being a method in a class. Eg, For login tests there is a Login class which has methods testLogin(), testLogin2() etc For signup tests there is a Signup class has methods testSignup(), testSignup2(), ...