我可以写下面写的东西吗?我可以在方法之前声明一个特定的测试用例,就像我们在describe块中所做的那样。
describe('demo test suite', function(){
it('demo test case one', function(){.....})
it('demo test case two', function(done){
before(function(){
//Do some operation only for this particular test case
})
//Do some operation again
})
})
答案 0 :(得分:4)
你的意图对我来说有点不清楚,但你可以嵌套描述函数:
describe('demo test suite', function(){
it('demo test case one', function(){.....})
describe('demo test case two', function(done){
before(function(){
//Do some operation
})
it('....', function(){
//Do some operation again
})
})
})