如何将我的功能调制为单独的并行测试? [英] how to modulate my functions as seperate parallel tests?

查看:95
本文介绍了如何将我的功能调制为单独的并行测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用nightwatch.js和浏览器堆栈,并正在运行一系列如下所示的测试功能;从登录点到更深层的操作贯穿我的应用程序.

I am using nightwatch.js and browser stack and am running a series of test functions that look like below; that run through my application from login point to deeper actions.

i.e.

this.TeamPanel = function(browser) {
        browser
        .url(Data.urls.oppListing)

        .waitForElementVisible("div#team.btn-icon", 1000)
        .click("div#team.btn-icon")

        .waitForElementVisible("div.side-panel.open", 1000)
//      .waitForElementVisible("div.box.team-member-summary-wrap.editable.fade-enter-done", 1000)

//      .waitForElementVisible("input#input", 1000)
//      .click("div#team.btn-icon")

        .waitForElementVisible("div.button", 1000)
        .click("div.button")

        Errors.checkForErrors(browser);

        browser.end();
};  

我想知道如何合并并行"测试;让我的功能报告作为单独的测试而不是一个庞大的测试.

I am wondering how to incorporate 'parallel' testing; to have my functions report as separate tests as opposed to one huge test.

我尝试将以下内容包装在我的函数周围,但没有运气:'

I've tried wrapping the below around my functions with no luck: '

 module.exports = {

  }; 

推荐答案

如果您使用的是示例 nightWatch- browserstack 项目,以调制测试,您需要拆分测试功能并将其放在单独的.js文件中,然后将该文件放在单个"文件夹或套房"文件夹下.如果您的测试功能依赖于其他功能(例如登录),请确保也将登录"功能添加到其他文件中.我创建了一个示例项目,在此处进行了调整.如果查看单个文件夹,将找到两个名为'TestCase1.js'和'TestCase2.js'的.js文件,它们是两个独立的测试函数.同样,将测试功能添加到单个"或套件"文件夹中. 单个"文件夹的意义在于,单个"文件夹下的所有功能将以顺序方式(即一个接一个地执行)执行.而"suite"文件夹下的功能将以并行方式执行.

If you are using sample nightWatch-browserstack project, to modulate your tests, you need to split your test functions and place them in seperate .js files and put the file either under 'single' folder or 'suite' folder. If your test functions are dependent on other functions say login, then ensure you add the 'login' function in other files too. I have created a sample project tweaking the above project here. If you look into the single folder, you will find two .js files named 'TestCase1.js' and 'TestCase2.js' which are two separate test functions. Similarly, add your tests functions to either of 'single' or 'suite' folders. The significance of 'single' folder is all the functions under 'single' folder will be executed in sequential fashion ie one after the other. Whereas the functions under the 'suite' folder will be executed in parallel fashion.

这篇关于如何将我的功能调制为单独的并行测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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