首页 > 解决方案 > 是否可以从命令行向 Nightwatch 发送参数?

问题描述

我有一个 jenkins 工作,它发出一个 XML 请求并返回一个答案。从这个答案中,我有一个我需要在夜间开始测试的字符串。

有谁知道我如何将这个字符串发送到守夜人?也许通过命令行参数?但是接下来怎么读呢?

标签: seleniumjenkinssoapuinightwatch.js

解决方案


Since you're using a NodeJS-based framework, why not make use of a process.env variable?

Suppose you need to tell your script what environment you want to run your checks agains. Let's call our system variable ENV. Your command will become:

ENV=prod nightwatch nightwatch.conf.js --yourOtherSwitches

In your page-objects/feature-files, you call the variable using process.env.ENV.


推荐阅读