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

使用Selenium在Bamboo执行测试后,如何查看未显示的测试失败结果?

如何在Bamboo中查看Selenium自动化测试的失败结果(测试标签页未显示时)

Hey there! I’ve run into this exact issue with Bamboo and Selenium before, so let me walk you through the most reliable ways to track down those test failure details even when the Tests tab isn’t showing them:

1. 优先查看构建日志(Build Logs)

This is the first place I always check—even if the Tests tab is missing, the raw logs will almost always have your failure details.

  • Navigate to your build’s result page and click the Logs tab.
  • Use the search bar to filter for keywords like FAILED, Exception, error, or even org.openqa.selenium to zero in on Selenium-specific stack traces.
  • You’ll find full error details here, like element not found exceptions, timeout errors, or assertion failures that your Selenium script threw.

2. 检查测试报告文件(如果用TestNG/JUnit)

If you’re using a standard test framework, your failure details are probably stored in a report file—Bamboo just isn’t displaying it in the Tests tab because of a configuration gap.

  • Head to the Artifacts tab on your build result page. Look for generated test report folders (like surefire-reports for JUnit, test-output for TestNG) or XML/HTML report files. Download these and open them locally to see a structured view of failed tests, including exact error messages and stack traces.
  • If you don’t see artifacts listed, check the build logs for lines like [INFO] Generating test report at /path/to/report—this tells you where the reports are stored. You can then add a Publish test results task in your Bamboo build configuration, pointing to this path, so future builds will populate the Tests tab correctly.

3. Verify your Selenium script’s error handling

Sometimes the issue is that your script isn’t properly exposing failures to Bamboo.

  • Make sure you’re not swallowing exceptions with try-catch blocks without logging or rethrowing them. For example, in TestNG/JUnit, let assertion failures throw naturally instead of hiding them:
    // Do this: Let the framework catch the failure
    Assert.assertEquals(driver.findElement(By.id("username")).getText(), "Expected User");
    
    // Don't do this: Swallowing the error means Bamboo never sees it
    try {
        Assert.assertEquals(..., ...);
    } catch (AssertionError e) {
        // No logging or rethrow = Bamboo thinks the test passed
    }
    
  • Add explicit logging (using tools like SLF4J or Log4j) to your script to output detailed error messages when something goes wrong—this makes it way easier to spot issues in the build logs.

4. Double-check your Bamboo test task configuration

If the Tests tab is consistently missing, it’s likely a setup issue in your build plan.

  • Go to your build plan’s Configure page, find the task responsible for running tests or publishing results.
  • Verify that the test report path is correctly set:
    • For JUnit: **/surefire-reports/*.xml
    • For TestNG: **/test-output/*.xml
  • Ensure the Fail the build if tests fail option is checked—this will mark the build as failed immediately, making it easier to notice when tests go wrong.

内容的提问来源于stack exchange,提问作者Juan David Vanegas Romero

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 07:07:03