6

I have two test files (lets say they're SomethingTestA and SomethingTestB).

Inside SomethingTestA, I have a bunch of mini smoke tests methods, like so

@Test
public void testCreate() {
 ...
}
@Test (dependsOnMethods = {"testCreate"})
public void doSomethingA() {
 ...
}
@Test (dependsOnMethods = {"testCreate"})
public void doSomethingB() {
 ...
}
@Test
public void doSomethingC() {
 ...
}

I have two problem:

1) I am getting the error: doSomethingA() is depending on method public void testCreate(), which is not annotated with @Test or not included. This happens for all three doSomething()

Now, the second problem is with SomethingTestB()

@Test
public void aTest() {
 System.out.println("Hello"); 
}
@Test
public void anotherTest() {
 ...
}

2) Whenever I try to run or debug a test method in SomethingTestB, if the test fails, eclipse automatically runs the entire SomethingTestA class after running SomethingTestB.

If I comment out the @Test for testCreate() in SomethingTestA, I get the "depending on method public... error" because it runs SomethingTestA automatically.

This only happens with Something TestA class, and I'm not sure why. How can I fix this?

Helping Hands
2,5443 gold badges30 silver badges54 bronze badges
asked Jun 17, 2014 at 15:55
2
  • You may need to include the entire class in your xml as described here: groups.google.com/forum/#!topic/testng-users/ciy1C9Bt9FY Commented Jun 30, 2014 at 17:40
  • I wish I could help you here, but I can't. If you could describe more about how you actually run your tests in eclipse (there are several ways) it might be easier. Also, three of your four tags are not relevant for your specific problem. I'm guessing that a JUnit tag would fit better. Commented Jul 8, 2015 at 14:19

1 Answer 1

1

Junit ignore tags are a good fit here , add this to the tests you don't want to run and that way it will not run the tests that are tagged to be ignored

ECiurleo
2,0431 gold badge16 silver badges45 bronze badges
answered Jul 26, 2015 at 16:00

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.