不同包中的TestNG注释超类

不同包中的TestNG注释超类,testng,Testng,我在不同的包中有一个超类和一个子类。超类具有@BeforeClass和@beforethod注释 但是,这些方法从未被调用。如果我将这两个类移动到一个公共包中,那么在调用\u xx方法之前,这两个@方法都可以 超级班: package com.blah.focus.test.integration; import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; public cla

我在不同的包中有一个超类和一个子类。超类具有
@BeforeClass
@beforethod
注释

但是,这些方法从未被调用。如果我将这两个类移动到一个公共包中,那么在调用\u xx方法之前,这两个
@方法都可以

超级班:

package com.blah.focus.test.integration;

import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;

public class BookSuper {

@BeforeClass(groups = "unit")
void prepareDataSet() throws Exception {
    System.out.println("Inside prepareDataSet");        
}

/**
 * 
 * @throws Exception
 */
@BeforeMethod(groups = "unit")
void beforeTestMethod() throws Exception {
    System.out.println("Insde beforeTestMethod yy");

}
} 
子类:

package com.blah.focus.domain;

public class BookTest extends BookSuper{
private Book book;

@Test(groups = "unit")
public void testGoodBookConstruction() {
    book = new Book();
    book.setAuthor("Henry");
    book.setTitle("Good Title");
    book.setPublished(new Date());
    book.setPublisher("Rodale");
}
}

这是设计的吗?

不,它应该有用,而且对我也有用:

Inside prepareDataSet
Insde beforeTestMethod yy

===============================================
SingleSuite
Total tests run: 1, Failures: 0, Skips: 0
===============================================

您可能遗漏了一些信息。

首先,能得到塞德里克·贝斯特这样的人的回复,我感到非常荣幸。非常感谢。是的,我犯了一个(非常)愚蠢的错误。甚至不会解释。:-)