Unit testing 在使用jacoco:cover运行的TC中调用公共构造函数时出错
当我使用jacoco:cover运行我的play代码时,当调用构造函数时,测试用例执行失败 简单地说:我的测试代码如下Unit testing 在使用jacoco:cover运行的TC中调用公共构造函数时出错,unit-testing,junit,playframework-2.0,code-coverage,jacoco,Unit Testing,Junit,Playframework 2.0,Code Coverage,Jacoco,当我使用jacoco:cover运行我的play代码时,当调用构造函数时,测试用例执行失败 简单地说:我的测试代码如下 @Test public void ValidSessionIdFindBySessionId() throws Exception { RightnowAccount rightnowAccount = new RightnowAccount("Login", "Password", 123, "SessionId"); } 我的类和构造函数: public cl
@Test
public void ValidSessionIdFindBySessionId() throws Exception
{
RightnowAccount rightnowAccount = new RightnowAccount("Login", "Password", 123, "SessionId");
}
我的类和构造函数:
public class RightnowAccount extends Model
{
private static final Logger logger = org.apache.log4j.Logger.getLogger(RightnowAccount.class);
@Id
public String login;
public String password;
public int accountId;
String sessionId;
Timestamp createdTimeStamp;
Timestamp updatedTimeStamp;
public RightnowAccount (String login)
{
this.login = login;
}
public RightnowAccount (String login,String password,int accountId,String sessionId)
{
this.login = login;
this.password = password;
this.accountId = accountId;
this.sessionId = sessionId;
}
}
当我以play:cover的形式运行测试代码时,我的测试用例失败,出现错误:
[error] Test com.flipkart.rightnow.connection.RightnowAuthTest.ValidSessionIdFindBySessionId failed: missing behavior definition for the preceding method call:
[error] RightnowAccount.$jacocoInit()
[error] Usage is: expect(a.foo()).andXXX()
[error] at org.easymock.internal.MockInvocationHandler.invoke(MockInvocationHandler.java:42)
测试是否有Before或After方法?似乎easymock试图对jacoco检测的类进行检测。您是将jacoco与代理(联机检测)一起使用还是与脱机检测一起使用?它是脱机检测