You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行Robot Framework Maven命令报错:Suite 'Acceptance'无测试或任务

问题解决:Robot Framework Maven插件执行报错“Suite contains no tests or tasks”

错误根源

核心问题是TestCase.robot文件中没有定义可执行的测试用例——当前文件仅包含库导入、变量和自定义关键字,但缺少*** Test Cases ***区块,导致Robot Framework识别不到需要运行的测试任务,从而抛出Suite 'Acceptance' contains no tests or tasks错误。

解决方案

1. 补充测试用例区块

修改TestCase.robot文件,添加*** Test Cases ***部分,调用已定义的关键字构建可执行的测试逻辑:

*** Settings ***
Documentation  包含登录功能测试的用例文件
Library        SeleniumLibrary

*** Variables ***
${BROWSER}    Firefox
${LOGIN URL}  https://trainee-web-app.azurewebsites.net/auth/login

*** Keywords ***
Open Browser To Login Page
   Open Browser  ${LOGIN URL}  ${BROWSER}
   Maximize Browser Window

*** Test Cases ***
验证登录页面正常打开
    Open Browser To Login Page
    # 可继续添加后续测试步骤,比如验证页面标题、核心元素等
    Close Browser

2. 确认Maven插件路径配置(可选)

如果pom.xml中配置了robotframework-maven-plugin,确保测试文件路径指向正确,示例配置如下:

<plugin>
    <groupId>org.robotframework</groupId>
    <artifactId>robotframework-maven-plugin</artifactId>
    <version>2.1.0</version> <!-- 或你升级后的版本 -->
    <configuration>
        <testSourcesDirectory>src/test/RobotFramework/acceptance</testSourcesDirectory>
        <includes>
            <include>**/*.robot</include>
        </includes>
    </configuration>
</plugin>

3. 验证依赖与环境

  • 确认SeleniumLibrary已正确安装(可通过pip install robotframework-seleniumlibrary检查)
  • 确保Firefox浏览器及对应版本的GeckoDriver已配置到系统PATH中

执行验证

修改完成后,重新运行Maven命令:

mvn robotframework:run

内容的提问来源于stack exchange,提问作者H1312

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 21:32:03