testng

Does TestNG guarantee @BeforeSuite methods are executed before @BeforeTest methods?

BACKGROUND: My goal is to code a TestNG-Selenium system that runs self-contained (no strings to maven or ant plugins; just java). It must allow for test cases to accept parameters including the browser and the domain url. When the TestRunner instantiates these test cases, the browser and domain are used to get a Selenium object to perfor...

Which UnitTest framework to learn for Java now?

Hi all: Although I have programmed with Java for roughly 3 years + now (not day-to-day but at least I understand the fundamentals), haven't really come into the field of Unit Testing... My work is now more Testing / Problem Analysis oriented, so I reckon a good Java Unit Testing Framework will be quite helpful to this role. Obviously ...

Should this be a synchronized method?

I'm using TestNG to run tests in parallel and want to be careful about possible synchronization issues with helper classes and utilities. To my knowledge, each test is its own object, transparently created by the test runner. Thus, I don't need to worry about synchronizing anything non-static, since it would be an object created in a Thr...

JUnit vs TestNG

For one reason or another I've been asked to write a short summary to what the advantages and disadvantages of both JUnit and TestNG are compared to each other. Ideally I want to suggest what types of project each would be used for. I have essentially no experience with Unit Testing, so I have been reading up on each of the tools, as we...

Problem: failed to create task or type testng. Cause: The name is undefined.

Hi @all, i´ve got a little problem to run a testng test. I invoke the test with a ant task which returns following error message: BUILD FAILED /**/build.xml:136: Problem: failed to create task or type testng Cause: The name is undefined. Action: Check the spelling. Action: Check that any custom tasks/types have been declared. Action: ...

TestNG works fine for me but throws com.google.inject.internal.asm.util.TraceClassVisitor classnotfoundexception for other engineer

My ANT script runs without issue on my linux machine and on some xp VMs. When another engineer tries to kick it off locally, TestNG throws [testng] Caused by: java.lang.ClassNotFoundException: com.google.inject.internal.asm.util.TraceClassVisitor not found in (my libraries are all in here) I've never seen this class before and don't kno...

different excel sheets for same dataprovider

Is it possible to use different excel sheets for different test methods sharing the same dataprovider in testng ...

testng from ant: specify -server -Xms ?

I'm running testng from ant using the task. I'd really like to add the -server option to the forked jvm as well as specifying the amount of heap space. Anyone know how to do it? I don't see anything here: http://testng.org/doc/ant.html Thanks, Ben ...

How do I have TestNG run tests in specific groups (from the command-line)?

I'm invoking TestNG from the command-line like this: java org.testng.TestNG -groups "foo" testng.xml ...with the intention of only running tests annotated with: @Test(groups = { "foo" }) ...but it's running all my tests. Do I need to change my testng.xml file? <suite name="BarSuite" verbose="1"> <test name="AllInPackage"> ...

Using multiple Classes with Maven/Hudson and TestNG

We use several testing classes within one test folder. When I run mvn test, all tests are run and I can see the output in the shell. But the resulting testng-results.xml only has the results of the last class which was tested in it. This isn't too bad for me, but our hudson server only displays these last results and only marks a build a...

GWT+Java: Globals, Singletons, and Headaches.

So here's my project: I am building a central interface/dashboard to present the test data for several test types of multiple product versions. We're using TestNG on our massive product, and while not enough tests are being written, that's a discussion for another topic. Here's what the directory structure looks like: Filesystem/prod...

Selenium grid tests with TestNG - multiple tests on multiple machines

Hi, we have a running selenium grid setup. Before the grid, when I started the tests with the suite parameter parallel="tests" it would start several browser instances on the same machine. Now that I've set up the grid, it only starts one test per machine. How can I change it, so that more tests per machine are started? ...

TestNG test reuse

Need some help thinking in TestNG terms. I have a large third party test suite written in TestNG and I'd like to be able to compose tests from it and run them from Intellij or Maven Is it possible to compose tests together programmatically and still leverage the runners built into these other frameworks. In JUnit you could do this: ...

IntelliJ IDEA + TestNG: Run a method before each test in a group

I'm learning to use TestNG for IntelliJ IDEA 9. As far as I understand, One way to put a test in a group called name is to annotate it @Test(group = "name"). To run a method before each test, annotate it with @BeforeMethod. In my test setup I want a method to run before each test only in a particular group. So there is a method beforeA...

checking broken links on a page parallely using selenium and java

The task is to check broken links on a webpage using selenium RC and java . It can be done simply by a) click on link A b) wait for page to open c) focus on this window d) verify text present on this page e) Close this window Then follow steps a to e for links B , links C .... links N This process is sequential. Is it possible to ...

TestNG: How to test for mandatory exceptions?

I'd like to write a TestNG test to make sure an exception is thrown under a specific condition, and fail the test if the exception is not thrown. Is there an easy way to do this without having to create an extra boolean variable? A related blog post on this subject: http://konigsberg.blogspot.com/2007/11/testng-and-expectedexceptions-iv...

Running TestNG testng.xml tests from Eclipse

I have some packages com.company.testing.module1 com.company.testing.module2 com.company.testing.module3 I also have some classes that have TestNG annotations in com.company.testing.tests Now I put testng.xml in com.company.testing The XML file looks like <?xml version="1.0" encoding="UTF-8"?> <suite name="Foo"> <test na...

When need to run tests from 2 classes from testng.xml, why the testng pick mehods randomly from classes?

I have tests from 2 classes need to run, and trigger from testng.xml use config like <classes> <class name="com.xyz.TestA"></class> <class name="com.xyz.TestB"></class> </classes> In TestA, have methods: i1, i2, i3, i4 In TestB, have methods: j1, j2, j3, j4 then test run as following sequence. i1, i3, j1, j4, i2, i4, ...

Multi-Test TestNG.xml file results in java.lang.NullPointerException

Multi-Test TestNG.xml file results in java.lang.NullPointerException Hello Quality Team, I need help getting TestNG to run multiple tests from one XML file. So far my efforts to do this result in a java.lang.NullPointerException OR the test(s) fake_execute="says it ran...but how can it have run if it didn't start selenium?" One final...

I am new to automated testing in Java. Which tool should I prefer? JUnit or TestNG?

I have read some comparisons of JUnit and TestNG and it looks like TestNG has more configuration options. On the other hand JUnit is more supported by IDEs, building tools, has more plugins. I have no experience in writing unit tests. Which tool should I prefer? P.S. I think my question is more like: Should I give TestNG a try, or just...