onCleanUp() vs onComplete() vs afterLaunch()

僤鯓⒐⒋嵵緔 提交于 2019-12-21 20:29:18

问题


In Protractor, there is a "global set up" method called onPrepare(), but I'm not completely sure what is meant to be a "global tear down" - there are three relevant methods: onCleanUp, onComplete and afterLaunch that are all called after a test execution.

Why does protractor have three methods called after a test run? What is the difference between onCleanUp, onComplete and afterLaunch?


I've also noticed that there is an "exit" event that we can attach a callback to (example here):

protractor.on('exit', function (status) {

});

回答1:


onComplete will be executed once per capability after all tests have finished, but the webdriver instance has not yet been shut down.

onCleanup will be executed once per capability after all tests have finished and the webdriver instance has been shut down

afterLaunch will be executed only once before program exits; after all capabilities are finished (after all onCleanup)

Further information on protractor callback functions can be found in their GitHub documentation.



来源:https://stackoverflow.com/questions/34377409/oncleanup-vs-oncomplete-vs-afterlaunch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!