如何将Eclipse中Java编写的Selenium脚本集成到VSTS Test Manager?
Integrating Eclipse with Azure DevOps Test Manager for Java Automated Tests
Hey there! Let's walk through how to connect your Eclipse-written Java automation tests with Azure DevOps Test Manager (formerly VSTS Test Manager), plus set up smooth collaborative development and version control—since you already have Team Explorer Everywhere (TEE) set up, we can build right on that.
1. Link Your Eclipse Test Code to Test Manager Test Cases
First, you need to map your Java test methods to Test Manager's test cases so they're linked up:
- Make sure your tests use standard frameworks like JUnit or TestNG (Test Manager natively supports these for result syncing). Double-check your test methods have the right annotations (like
@Test). - In Eclipse, open the Test Plans view (if it's missing, go to
Window > Show View > Other > Team Foundation Server > Test Plans). - Navigate to your target test plan/test suite in Azure DevOps, then create or select an existing Automated Test type test case.
- Go to the test case's Automation tab, click Associate Automation, then use the search to find the corresponding test class/method in your Eclipse project. TEE will scan your project for valid test methods automatically.
- Save the association—now Test Manager knows exactly which script maps to which test case.
2. Run Tests & Sync Results (Local or Pipeline)
Run Locally from Eclipse & Sync to Test Manager
- In the Test Plans view, right-click your linked test case and select Run Automated Test. This triggers Eclipse to run the associated script, and once finished, the pass/fail status and logs will auto-sync to Test Manager's test results.
- To view detailed logs in Test Manager, go to the test run's details page—you can expand each test case to see the stack traces or custom logs from your Java code.
Run via Azure DevOps Pipeline (For CI/CD)
If you want to run tests on a hosted agent (and generate formal reports):
- Push your Eclipse project to your Azure DevOps Git/TFVC repo first: Right-click your project >
Team > Committo stage changes, thenPushto send them to the repo (TEE handles this seamlessly). - In Azure DevOps, create a Build Pipeline and add tasks for your build tool (Maven/Gradle) to compile the project.
- Add a test task: For Maven, use the
mvn testgoal; for TestNG/JUnit, use the dedicated test tasks in the pipeline library. - Add the Publish Test Results task, set the result format to JUnit/TestNG (match your framework), and point it to the report directory (e.g.,
target/surefire-reportsfor Maven). This will auto-import results into Test Manager, where you can view full reports and logs.
3. Collaborative Development & Version Control
Since you already have TEE integrated, managing shared code is straightforward:
- Share your project: Right-click your Eclipse project >
Team > Share Projectand link it to your Azure DevOps repo (Git or TFVC). - Collaborate with teammates: Other engineers can clone the repo to their Eclipse via TEE, make changes, commit, and push. You can pull their updates directly in Eclipse, and use the built-in conflict resolution tool if there are overlaps.
- Branch strategy best practice: Use a
mainbranch for stable code, and have each developer work on feature branches. When changes are ready, submit a Pull Request (PR) for code review before merging tomain—this keeps your test scripts reliable and tracked.
4. Troubleshooting Quick Fixes
- Missing Test Plans view: Update your TEE plugin via Eclipse Marketplace—older versions might not include this feature.
- Can't associate automation tests: Verify your test methods have valid
@Testannotations, and that your project is properly linked to the Azure DevOps repo in TEE. - Results not syncing: Check Eclipse's connection to Azure DevOps (go to
Window > Preferences > Team > Team Foundation Serverto confirm). If local sync fails, you can manually upload the test result XML file (generated by Eclipse in your project's build directory) to Test Manager's test run page.
内容的提问来源于stack exchange,提问作者pranava naini
相关产品推荐
相关产品推荐

