Azure DevOps测试套件添加时间评估总时长展示需求咨询
Great question! Since Azure DevOps doesn’t natively support calculated fields for test suites that roll up values from child test cases, here are three feasible, practical approaches to achieve your goal:
1. Automated Roll-Up via Power Automate (Microsoft Flow)
This is the most accessible no-code/low-code option. We’ll create a custom field for test suites and use Power Automate to automatically calculate and update the total time whenever test cases are added, removed, or their time evaluation field changes.
Step-by-Step Setup:
- Create a Custom Field for Test Suites:
- Navigate to your Azure DevOps project > Project Settings > Work Items > Process.
- Select your project’s process (e.g., Agile, Scrum) > Test Suite work item type.
- Add a new field: Name it
Total Time Evaluation, set the type toDecimal(to support fractional hours), and mark it as optional (we’ll populate it via automation).
- Build the Power Automate Flow:
- Create a new flow with two triggers:
- When a work item is created (filter for the
Test Casetype) - When a work item is updated (filter for
Test Casetype where thetime evaluationfield is modified)
- When a work item is created (filter for the
- For each trigger, add an action to Get test cases in test suite (using the Azure DevOps connector) to identify all suites that include the updated test case.
- For each target test suite, fetch all its associated test cases, sum their
time evaluationvalues. - Use the Update work item action to set the suite’s
Total Time Evaluationfield to the calculated sum.
- Create a new flow with two triggers:
Notes: Don’t forget to handle edge cases like test cases being removed from suites—add a trigger for work item deletion, or set up a periodic flow to re-calculate totals for all suites to ensure accuracy.
2. Custom Dashboard Widget Using Azure DevOps REST API
If you prefer real-time display without storing the value in a work item field, build a custom dashboard widget that calculates the total on-the-fly using the Azure DevOps REST API.
Key Steps:
- Fetch Data via REST API:
- Use the
Test Suites - Getendpoint to retrieve details of a target suite, then theTest Cases - Listendpoint to pull all test cases in that suite. - Sum the
time evaluationvalues from the returned test cases.
- Use the
- Build the Custom Widget:
- Use the Azure DevOps Dashboard Widget SDK to create a dedicated widget that displays the total time for the selected test suite.
- For a simpler workaround, you can use a Markdown widget with embedded JavaScript (note: this has limited functionality but works for basic display).
Benefit: Real-time calculations without needing to maintain an automated flow. Drawback: Requires basic development skills to build and deploy the widget.
3. Third-Party Extensions from Azure Marketplace
Skip the custom build and check the Azure DevOps Marketplace for pre-built extensions that handle test suite metrics. Popular options include:
- Test Suite Metrics: Extensions that aggregate test case data (including time estimates) into suite-level totals.
- Test Management Enhancements: Tools that add roll-up fields for test suites, including time tracking and other key metrics.
Pro Tip: Look for extensions with free trials to test if they align with your team’s workflow before committing to a paid plan.
Each approach has its tradeoffs: Power Automate is ideal if you want the total stored directly in the test suite work item, the REST widget offers real-time display, and extensions provide out-of-the-box functionality. Pick the one that best fits your team’s technical capacity and needs!
内容的提问来源于stack exchange,提问作者Linux Dev

