Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unit testing 在使用jacoco:cover运行的TC中调用公共构造函数时出错_Unit Testing_Junit_Playframework 2.0_Code Coverage_Jacoco - Fatal编程技术网

Unit testing 在使用jacoco:cover运行的TC中调用公共构造函数时出错

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

当我使用jacoco:cover运行我的play代码时,当调用构造函数时,测试用例执行失败

简单地说:我的测试代码如下

@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与代理(联机检测)一起使用还是与脱机检测一起使用?它是脱机检测