testng

How to generate tests with different names in testng, java?

I'm using testng to run selenium based tests in java. I have a bunch of repeated tests. Generally they do all the same except of test name and one parameter. I want to automate generation of it. I was thinking about using factory. Is there a way to generate tests with different name? What would be the best approach to this? As for now...

Debugging TestNG configuration failures

I'm running testng from ant. I'm using my own test listeners. I'm refactoring the code and once a while I got [testng] Total tests run: 7, Failures: 0, Skips: 7 [testng] Configuration Failures: 1, Skips: 2 What will be the best approach to fix configuration failures? ...

springTestContextBeforeTestMethod failed in Maven spring-test

I try to setup a project with spring-test using TestNg in Maven. The code is like: @ContextConfiguration(locations={"test-context.xml"}) public class AppTest extends AbstractTestNGSpringContextTests { @Test public void testApp() { assert true; } } A test-context.xml simply defined a bean: <bean id="app" class="or...

Can I run a specific testng test group via maven?

I have several testng test groups, e.g. group1,group2,group3... These are defined in my pom.xml and all get run when I execute "mvn test". What do I need to run to only execute one group without having to modify the groups configured in the pom.xml. i.e mvn test group2 mvn test group1 mvn test group3 ...

TestNG - Factories and Dataproviders

Background Story I'm working at a software firm developing a test automation framework to replace our old spaghetti tangled system. Since our system requires a login for almost everything we do, I decided it would be best to use @BeforeMethod, @DataProvider, and @Factory to setup my tests. However, I've run into some issues. Sample Te...

How do I get the name of the test method that was run in a testng tear down method?

Basically I have a tear down method that I want to log to the console which test was just run. How would I go about getting that string? I can get the class name, but I want the actual method that was just executed. Class testSomething() { @AfterMethod public void tearDown() { system.out.println('The test that just ran ...

Problem Installing older TestNG plugin on Eclipse 3.5

I'm trying to install TestNG 5.11 on eclipse 3.5 and gettign the following. eclipse.buildId=unknown java.version=1.6.0_19 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=no_NO Framework arguments: -product org.eclipse.epp.package.jee.product Command-line arguments: -os win32 -ws win32 -arch x86...

java.lang.IllegalStateException: missing behavior definition for the preceding method call getMessage("title")

Hi All, I'm using EasyMock(version 2.4) and TestNG for writing UnitTest. I have a following scenario and I cannot change the way class hierarchy is defined. I'm testing ClassB which is extending ClassA. ClassB look like this public class ClassB extends ClassA { public ClassB() { super("title"); } @Override ...

How do I capture java.util.logging output in TestNG?

Dear All: I am sorry just wanted to know if this was possible? I have discovered an interesting issue with JUnit and am looking for alternatives. Thank you Misha p.s. Here is JUnit issue: import org.junit.After import org.junit.Before import org.junit.Test import static org.junit.Assert.* class MyTestTest { @Before public void bef...

Capture console output in TestNG?

Dear All: I am using TestNG+ReportNG per wiki instructions in gradle (I fixed on cookbook as default example did not work form me). http://docs.codehaus.org/display/GRADLE/Cookbook#Cookbook-addreporters I would like to somehow capture console output in TestNG. Is this possible? Thank you Misha ...

testng and gradle - see output from deadlocked tests?

If I have a test that hangs I don't seem to get any results. Is there any way to see output live? Thank you Misha ...

How to generate testNG-xslt report using Ant?

Hi, I'm having problem in generating the testNG-xslt report using Ant. I have did whatever have mention in Varun's blog, I did include the saxon.jar and the testng-results.xsl in my project folder, but still couldn't get my expected result. 1) I would like to know how the testng-results.xml file is generated. Because I couldn't get the...

Passing output of one test method to another method testng

Hi, I have to write the following unit test cases in testng: 1) saveProductTest which would return productId if product details are saved successfully in DB. 2) modifyProductTest, it should use previously saved productId as a parameter. I am taking the product details input(PrdouctName, ReleaseDate) for saveProductTest and modifyProd...

In TestNG is there a way to run a cleanup method only after a particular test method?

One example: after a password change test executes I would like to a cleanup method to reset the password back to the original password. Annotating the cleanup method with @AfterGroups and making the test method as the only method in a group is one way but it doesn't feel right. ...

TestNG Ant tasks vs Surefire

I was wondering how different surefire is when executing TestNG than TestNG ant tasks? The reason is that I am seeing consistent difference in behavior when trying to run a TestNG test that extends a JUnit test base (this is a workaround to run JBehave tests in TestNG described here: http://jbehave.org/documentation/faq/). Surefire detec...

Maven - add custom phase to execute plugin with other configuration

I have two set of integration tests in one maven project - automatic and manual tests. The manual tests are few but tedious - they require pulling the plug of servers etc. I would like to create a separate goal for the manual tests, so i can run something like mvn manualtests to run the manual tests. If you just run a normal maven build ...

Setting application log level in TestNG

I have an application that uses Commons Logging for logging. It's built with Maven, and uses TestNG for testing. I'm trying to fine-tune the logging level during tests, but not having any luck - everything is set to INFO, no matter what I do. I tried creating a logging.properties file on the classpath, and it does absolutely nothing. I a...

Capturing Log4j output when executing TestNG tests

I am executing TestNG tests , and the logging output is set to DEBUG, so in case of a failure I can get to inspect exactly what goes wrong. The problem is that the output is extremely verbose, and it's bothering everyone when it runs . I would like to capture all Log4J logging events - which is easy - and only print them when the test f...

Loading datasets in consecutive tests fails with "closed session"

Hi all, I have 2 test classes, both annotated with the unitils annotation @DataSet("/dbunit-dataset.xml") The target database is an HSQLDB, which is initiated in an abstract superclass method annotated with the testng annotation: @BeforeClass When the testrunner (Maven Surefire) arrives at the 2nd test, the database is correctly i...

converting Hashtable array into object array.

Hi guys, My problem here is i cant able to convert the Hashtable array into object array. here content reading reads each and every row from the xls file and saves it in the hashtable array in this format: roleName=testRole981, admin=admin, projectName=Automateme, userPassword=aspiresys12, roleDesc=grant[testplan_execute],grant[testpla...