Results 1 to 3 of 3

Thread: Sprint-Test integration with JUnit Test Suite Problem

Hybrid View

  1. #1

    Default Sprint-Test integration with JUnit Test Suite Problem

    Hi all,

    I can execute individual test case with succeed, but when I try to execute a suite of them I get the next exception:

    java.lang.Exception: class 'www.iasoft.es.sigad.academica.modelo.impl.PersonB LImplTest' (possibly indirectly) contains itself as a SuiteClass


    My code for a single test is:

    PersonBLImplTest.java

    public class PersonBLImplTest extends BaseTest {

    @Autowired protected PersonBLImpl personBLImpl;

    @Test
    public void savePerson() {
    log.warn("Empieza");
    Person person = new Person();
    person.setFirstname("");
    long actualizado = personBLImpl.savePerson(person);
    assert (actualizado > 0);
    }

    }


    My code for the suite is:

    BaseTest .java

    @RunWith(Suite.class)
    @ContextConfiguration(locations = {"classpath*:applicationContextTest.xml"} )
    @TransactionConfiguration(defaultRollback = true)
    @Transactional
    @SuiteClasses({
    PersonBLImplTest.class,
    PersonBLImplTest2.class
    })

    public class BaseTest extends TestCase {
    @Autowired protected Log log;
    }


    Anyone can help me??

  2. #2

    Default

    The class PersonBLImplTest extending BaseTest inherits the test suite annotation so you are both adding it to a suite and calling it a suite. You will need to change your inheritance hierarchy to remedy this.

  3. #3

    Default Test Suites

    Quote Originally Posted by jasonparallel View Post
    The class PersonBLImplTest extending BaseTest inherits the test suite annotation so you are both adding it to a suite and calling it a suite. You will need to change your inheritance hierarchy to remedy this.

    Indeed you were right, I have created another class for launching the tests and base test class without suites and It works

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •