执行报如下错误:
[ RUN ] Nfs4OpGetattrFreeTest.StatusIsNFS4_OK
/home/mockcpp-master/src/ChainableMockObjectBase.cpp:84: Failure
Invocation is expected only once(), but it's been invoked 0 times
method(nfs4_Fattr_Free)
.expects(once())
.invoked(0)
.with();
unknown file: Failure
C++ exception with description "failed due to mockcpp exception" thrown in the test body.
[ FAILED ] Nfs4OpGetattrFreeTest.StatusIsNFS4_OK (0 ms)
需要测试的代码
测试代码
执行报如下错误: [ RUN ] Nfs4OpGetattrFreeTest.StatusIsNFS4_OK /home/mockcpp-master/src/ChainableMockObjectBase.cpp:84: Failure Invocation is expected only once(), but it's been invoked 0 times method(nfs4_Fattr_Free) .expects(once()) .invoked(0) .with(); unknown file: Failure C++ exception with description "failed due to mockcpp exception" thrown in the test body. [ FAILED ] Nfs4OpGetattrFreeTest.StatusIsNFS4_OK (0 ms)
分析上述报错的原因是:mock对象nfs4_Fattr_Free没有被调用。测试其他函数,MOCKER打桩的函数也没有生效,而是直接调用了原函数。
请问有没有碰到类似的问题,以及有没有解决办法