如何编写假阳性/阴性测试? 用于茉莉花或类似产品

问题描述

是否可以捕获茉莉花断言的通过/失败结果,并在结果击中报告者之前对其进行断言?

我目前正在开发一个内部测试框架,该框架将Jasmine和其他一些工具包装到一个内部测试框架/线束中。为了确认包装器不会产生假阴性或阳性,我希望能够对这些断言的结果进行断言,以确保它们是正确的。

在理想情况下,我希望能够执行以下操作:

let failWrapper = () => {
    fail("This spec is flagged to fail") // Invokes Jasmine fail method
}

...

it("wrapper function returns a test failure condition",()=>{
    let result = captureAssertionResult(failWrapper()) // Results go to this variable,not the html or terminal reporter
    expect(result).toBe(false) // Reporters mark this as a passing test
})

let equalWrapper = (a,b) => {
    expect(a).toBe(b) 
}

...

it("wrapper function returns a test failure condition",()=>{
    let result = captureAssertionResult(equalWrapper(0,1))
    expect(result).toBe(false)
})

captureAssertionResult会将Jasmine通过/失败结果转换为布尔值的地方。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...