JUnit error - IllegalArgumentException:Test class can only have one constructor

后端 未结 1 1163
忘了有多久
忘了有多久 2021-01-18 14:42

Unit testing is new to me, and I have this error I don\'t understand. I have 2 TestCases subclasses that work fine when ran standalone, but not in my test suite.

In

1条回答
  •  时光说笑
    2021-01-18 14:58

    If you are using JUnit4 your classes shouldn't extend TestCase, you just need the annotation @Test before your test methods.

    And your test suite should begin like this:

    @RunWith(Suite.class)
    @SuiteClasses({TaskTest.class, 
                    ResourceTest.class,
                    DateForTMSTest.class,
                    AvailableResources.class,
                    Model.class})
    

    0 讨论(0)
提交回复
热议问题