onCleanUp()vs onComplete()vs afterLaunch() [英] onCleanUp() vs onComplete() vs afterLaunch()

查看:147
本文介绍了onCleanUp()vs onComplete()vs afterLaunch()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Protractor中,有一个名为 onPrepare()的全局设置方法,但我不完全确定什么是全局拆除 - 有三种相关方法: onCleanUp onComplete afterLaunch 在测试执行后全部调用。

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.

为什么 量角器有测试运行后调用三种方法? onCleanUp onComplete afterLaunch 之间有什么区别?

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

我还注意到我们可以附加一个exit事件回调(此处示例):

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

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

});


推荐答案

onComplete ,但webdriver实例尚未关闭。

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

onCleanup

afterLaunch 将在程序退出前执行一次;完成所有功能后(毕竟 onCleanup

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

有关量角器回调函数的更多信息,请参阅他们的GitHub文档

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

这篇关于onCleanUp()vs onComplete()vs afterLaunch()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆