【问题标题】:Protractor - Cucumber config query量角器 - Cucumber 配置查询
【发布时间】:2018-08-13 23:03:23
【问题描述】:

我的查询是当我们说例如..“npm run test”时将如何调用 config.js,这将根据 config.js 中定义的配置运行测试

我的 package.json 包含的示例

"scripts" : {
"test" : "Env=ST CukeTags=regression testrunner -s functional"
}

我的另一个问题是,我在哪里可以找到有关这些配置文件、挂钩文件如何相互关联的详细信息?在量角器测试运行期间如何调用它们?

【问题讨论】:

  • 请提供更多关于testrunner的详细信息,它来自npm包或其他?

标签: protractor cucumberjs


【解决方案1】:

你应该在你的 package.json 中设置测试脚本

该测试脚本将告诉命令运行量角器并给出配置文件的路径。

 "scripts":{"test": "protractor typeScript/config/config.js"}

这里的测试命令将使用 typescript/config 文件夹中的配置文件运行量角器。

量角器和黄瓜的示例配置文件

    import * as path from "path";
import { browser, Config } from "protractor";
import { Reporter } from "../support/reporter";
const jsonReports = process.cwd() + "/reports/json";

export const config: Config = {

    seleniumAddress: "http://127.0.0.1:4444/wd/hub",

    SELENIUM_PROMISE_MANAGER: false,

    baseUrl: "https://www.google.com",

    capabilities: {
        browserName: "chrome",
    },

    framework: "custom",
    frameworkPath: require.resolve("protractor-cucumber-framework"),

    specs: [
        "../../features/*.feature",
    ],

    onPrepare: () => {
        browser.ignoreSynchronization = true;
        browser.manage().window().maximize();
        Reporter.createDirectory(jsonReports);
    },

    cucumberOpts: {
        compiler: "ts:ts-node/register",
        format: "json:./reports/json/cucumber_report.json",
        require: ["../../typeScript/stepdefinitions/*.js", "../../typeScript/support/*.js"],
        strict: true,
        tags: "@CucumberScenario or @ProtractorScenario or @TypeScriptScenario or @OutlineScenario",
    },

    onComplete: () => {
        Reporter.createHTMLReport();
    },
};

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-26
    • 2017-06-28
    • 1970-01-01
    • 1970-01-01
    • 2016-03-16
    相关资源
    最近更新 更多