0

我在包中有 5 个测试类:XYZ

测试类如下:A,B,C,D,。它们是相同的。课堂上的一切都是一样的。唯一的区别是类中还有另一个字段。

主要问题(令人困惑的问题)是,MVN 运行 A、B、C 测试用例而不是“D”。

在日志中只写了这个:

------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running ge.ddrc.transport.controller.rest
Running x.y.z.A
...
Running x.y.z.B
...
Running x.y.z.C

我使用 Eclipse。在 Eclipse 中,我可以毫无问题地运行测试用例(作为 JUnit 启动器)。这个类看起来像这样:

@Transactional
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(locations = { "/junit/spring/config/root-context.xml" })
public class D{

    @Autowired
    private TestService testServ;


    private MockMvc mockMvc;

    @Autowired
    private FilterChainProxy springSecurityFilterChain;

    @Autowired
    private WebApplicationContext wac;

    @Before
    public void setup() {
        this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).addFilters(this.springSecurityFilterChain).build();
    }


    @Test
    public void getInfo() throws Exception {
        System.out.println("OK INVOKED");

    }



}

你能告诉我会发生什么吗?为什么 mvn 不想运行这个类。有什么问题吗?mvn 运行另一个测试用例,但不是这个。

4

0 回答 0