在量角器中使用带有 angularjs 的 selenium 服务器做一些 aftereach 描述 [英] Doing something aftereach describe in protractor with selenium server with angularjs

查看:18
本文介绍了在量角器中使用带有 angularjs 的 selenium 服务器做一些 aftereach 描述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在每次描述之后(而不是在每个测试用例之后)和每次描述之前做一些事情,有没有办法做到这一点?我尝试了以下格式,但它给了我错误,在未定义之前和之后,是否可以在每个描述之前和之后执行某些任务:

I want to do something after each describe(not after each testcase) and before each describe, is there any way to do this? I have tried below format, but it gives me error that, before and after not defined, is it possible to do sometask before and after of each describe:

describe('testcase', function () {
    before(function () {
        --------------
    })
    beforeEach(function () {
       -----------------
    })
    afterEach(function () {
        --------------
    })
    after(function () {
        -----------------
    })
    it('task1', function () {
             -----------

    })it('task2', function () {
                  ------------------
    })
})

推荐答案

据我所知,你想要 beforeAllafterAlljasmine 2.1 中引入:

As far as I understand, you want beforeAll and afterAll which were introduced in jasmine 2.1:

beforeAll 函数只在所有规范调用之前调用一次运行描述,并且在所有规范之后调用 afterAll 函数结束.这些函数可用于加速测试套件昂贵的设置和拆卸.

The beforeAll function is called only once before all the specs in describe are run, and the afterAll function is called after all specs finish. These functions can be used to speed up test suites with expensive setup and teardown.

对于旧的 jasmine 版本,同样可以在 的帮助下完成jasmine-beforeAll.

For the older jasmine versions, the same can be done with the help of jasmine-beforeAll package.

这篇关于在量角器中使用带有 angularjs 的 selenium 服务器做一些 aftereach 描述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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