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

Rally C#技术问询:如何统计指定版本下负责人处理的特性数量?

Automate Rally Feature Stats by Version & Owner with C# SDK

Got it, let's tackle this problem of replacing your manual Rally report extraction with code using the C# SDK. This solution will automatically count features per specified version, break down ownership by your dev team, and track statuses like completed/blocked—exactly matching the manual report you're pulling now.

Prerequisite

First, make sure you've installed the Rally C# SDK via NuGet: search for Rally.RestApi and add it to your project. You'll also need an API key from Rally (generate one in your account settings) and the ref IDs for your workspace/project (find these in the URL when you navigate to them in Rally).

Full Code Implementation

using System;
using System.Collections.Generic;
using System.Linq;
using Rally.RestApi;
using Rally.RestApi.Response;

class RallyFeatureTracker
{
    static void Main(string[] args)
    {
        // Replace these with your actual Rally details
        const string RallyUrl = "https://rally1.rallydev.com";
        const string ApiKey = "your-rally-api-key-here";
        const string WorkspaceRef = "/workspace/123456789"; // Grab from Rally URL
        const string ProjectRef = "/project/987654321"; // Grab from Rally URL

        // Initialize the API client (using 'using' ensures clean connection disposal)
        using var restApi = new RallyRestApi(ApiKey, RallyUrl);
        restApi.SetWorkspace(WorkspaceRef);
        restApi.SetProject(ProjectRef);

        // List of versions you want to generate reports for
        var targetVersions = new List<string> { "Q2-1", "Q1-2" };

        foreach (var version in targetVersions)
        {
            Console.WriteLine($"=== {version} Feature Statistics ===");
            
            // Build query to fetch all features linked to the target version
            var featureQuery = new Query("Feature")
            {
                Fetch = new List<string> { "Owner", "State", "Release" },
                QueryString = $"Release.Name = \"{version}\""
            };

            var queryResults = restApi.Query(featureQuery);

            if (queryResults.TotalResultCount == 0)
            {
                Console.WriteLine("No features found for this version.\n");
                continue;
            }

            // Total features in the version
            int totalFeatures = queryResults.TotalResultCount;
            Console.WriteLine($"Total features in version: {totalFeatures}");

            // Filter features assigned to your dev team (adjust the username filter to match your team)
            var devTeamFeatures = queryResults.Results
                .Where(f => f["Owner"] != null 
                    && ((DynamicJsonObject)f["Owner"])["UserName"].Contains("your-dev-team-username-pattern"));
            int devTeamFeatureCount = devTeamFeatures.Count();
            Console.WriteLine($"- {devTeamFeatureCount} features assigned to the dev team");

            // Break down dev team features by status
            int completedCount = devTeamFeatures.Count(f => f["State"].ToString() == "Completed");
            Console.WriteLine($"  - {completedCount} completed");

            int blockedCount = devTeamFeatures.Count(f => f["State"].ToString() == "Blocked");
            if (blockedCount > 0)
            {
                Console.WriteLine($"  - {blockedCount} blocked (awaiting further info)");
            }

            // Calculate unassigned/pending features
            int unassignedOrPending = totalFeatures - devTeamFeatureCount;
            Console.WriteLine($"- {unassignedOrPending} features unassigned/awaiting further research\n");

            // Add Q1-2 specific note to match your manual report
            if (version == "Q1-2")
            {
                Console.WriteLine("Additional note: The team has completed all assigned deliverable features for this version.\n");
            }
        }
    }
}

Key Customizations You Need to Make

  1. Rally Connection Details: Swap out the placeholder values for ApiKey, WorkspaceRef, and ProjectRef with your actual Rally credentials and IDs (you can grab the ref IDs from the URL bar when navigating to your workspace/project in Rally).
  2. Dev Team Filter: Adjust the UserName.Contains() check to match your dev team's usernames. If you have a fixed list of team members, you could use an exact match like:
    var devTeamUsernames = new List<string> { "dev1@yourcompany.com", "dev2@yourcompany.com" };
    var devTeamFeatures = queryResults.Results
        .Where(f => f["Owner"] != null 
            && devTeamUsernames.Contains(((DynamicJsonObject)f["Owner"])["UserName"].ToString()));
    
  3. Status Values: Double-check that the State values (like "Completed" or "Blocked") match what's used in your Rally instance—some teams use "Done" instead of "Completed", so tweak this if needed.
  4. Q1-2 Custom Note: Modify the additional note to match your actual team's completion status as required.

How This Replaces Your Manual Work

  • The code connects to Rally, pulls all features tied to your target versions, and automatically groups them by owner and status.
  • It replicates exactly the breakdown you're doing manually: total features, dev team-assigned count, completed/blocked statuses, and unassigned/pending counts.
  • Using using for the API client ensures the connection is cleaned up properly after running, so you don't have to worry about lingering connections.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 04:10:19