2015-01-03 2 views
3

특정 assert이 실패 할 때 스크린 샷을 캡처 할 수 있습니까? 내가 테스트를 잡는다 때 글로벌 과정을 수행하는 것이 가능 문서 및 포럼에 참조하십시오 다음과 같이 실패 :CasperJS에서 특정 어설 션이 실패했을 때 스크린 샷을 캡처하는 방법은 무엇입니까?

casper.test.on("fail", function (failure) { 
    // Do something, "casper.capture" for example 
}); 

하지만 각 assert에 대한 specifical 과정을합니다. 내 말은 :

test.assertTitle(...) // if it fails, do this 
test.assertMatch(...) // if it fails, do that 
... 

가능합니까? 어떻게해야합니까?

답변

4

구글/포럼/코드 검색 후, 나는

try{ 
    test.assertxxx(...) 
} catch (e) { 
    casper.fail("It's a fail!"); 
} 
) = 그것을 발견