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?

2
  • You may need to include the entire class in your xml as described here: groups.google.com/forum/#!topic/testng-users/ciy1C9Bt9FY
    – Sam Woods
    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.
    – jumps4fun
    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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.