batch-file - 当我们使用 java (jython) 通过 bat 脚本为机器人项目运行机器人文件时出现导入错误
问题描述
我们使用 Jython 使用 java 创建了机器人框架,如下所示。
当我们从 Eclipse IDE 执行它时,它工作正常。
我们将把它配置到 Jenkins 中,我们已经为构建和测试创建了下面的批处理脚本
建造:
call mvn clean
call mvn assembly:assembly -DdescriptorId=jar-with-dependencies
build is created successfully
测试:
java -cp target\KTOC-TRB-automation-1.0-SNAPSHOT-jar-with-dependencies.jar;robotframework-3.0.2.jar -Dwebdriver.chrome.driver=chromedrivers\chromedriver.exe -Dheadless=false org.robotframework.RobotFramework --variablefile KTOC_TRB_TestAutomation\FrontlinesTRB\France.py --variablefile KTOC_TRB_TestAutomation\FrontlinesTRB\TRB-env.py KTOC_TRB_TestAutomation\TestSuites\RegressionTest_France.robot
当我们触发此脚本时,我们收到以下错误:
C:\Users\k64066262\rep\KTOC-TRB-Automation>test.bat >>status.txt [ ERROR ] Error in file 'C:\Users\k64066262\rep\KTOC-TRB-Automation\KTOC_TRB_TestAutomation\TestSuites\RegressionTest_France.robot': Importing test library 'com.KTOC.TRB.testautomation.Keywords.Keywords' failed: ImportError: No module named KTOC
错误信息 :
C:\Users\k64066262\rep\KTOC-TRB-Automation>java -cp target\KTOC-TRB-automation-1.0-SNAPSHOT-jar-with-dependencies.jar;robotframework-3.0.2.jar -Dwebdriver.chrome.driver=chromedrivers\chromedriver.exe -Dheadless=false org.robotframework.RobotFramework --variablefile KTOC_TRB_TestAutomation\FrontlinesTRB\France.py --variablefile KTOC_TRB_TestAutomation\FrontlinesTRB\TRB-env.py KTOC_TRB_TestAutomation\TestSuites\RegressionTest_France.robot ============================================================================== RegressionTest France ============================================================================== Verify Tender Created Successfully | FAIL | Parent suite setup failed: No keyword with name 'Launch Browser' found.
解决方案
推荐阅读
- java - 创建新线程时如何使用 lambda?
- python - 加密后得到一个奇怪的字符串,如何将其与正常的字母数字字符一致?
- pdf - 在 pandoc 上找不到 pdflatex
- teradata - 如何在 tera 数据 bteq 中显示更多列?
- firebase - 无法使用 Firebase Firestore 有条件地渲染 React Native 屏幕,理由是“缺少返回”
- javascript - 动态反应式表单控件
- android - 没有自定义工具栏的导航抽屉
- c# - 是否可以添加在单独的 cs 中创建的子元素
- redis - 如何获取 HMSET REDIS 中的所有值
- java - 就字符串池而言,字符串连接如何工作?