使用Selenium在Bamboo执行测试后,如何查看未显示的测试失败结果?
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 evenorg.openqa.seleniumto 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-reportsfor JUnit,test-outputfor 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-catchblocks 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
- For JUnit:
- 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

