首页 > 解决方案 > TestCafe:导出命令在 Linux 中不起作用

问题描述

我正在使用 testcafe 进行自动化。

根据文档设置环境变量,我set用于在本地export运行的 Windows 以及使用 Jenkins 作业在 Linux 环境中运行测试。在 Windows 中,它工作得很好。但在 Linux 导出命令中没有设置环境变量。

我在 Windows 中使用的 shell 命令set ENV=staging& npx testcafe \"chrome:headless --no-sandbox --disable-dev-shm-usage\" automation_suite/tests

我在 Jenkins 中使用的 shell 脚本命令在 Linux Jenkins 管道脚本上运行

  stage('Run tests') {
   steps {
    sh 'npm run ci360:smoketest:chrome:headless'
   }
  }

外壳命令

npm run ci360:smoketest:chrome:headless会自动调用命令

export ENV=staging& npx testcafe \"chrome:headless --no-sandbox --disable-dev-shm-usage\" automation_suite/tests在 package.json 的 scripts 部分定义

不知道这里有什么问题,我被困在这一点上。任何帮助表示赞赏。

标签: linuxjenkinstestingenvironment-variablestestcafe

解决方案


该问题已通过替换&;


推荐阅读