Friday, June 07, 2013
Team Foundation 2012: Run xUnit unit tests
You can find the binaries in the packages folder in your solution directory
Thursday, January 13, 2011
Lean Principle “See the whole”
The remaining work report showed a clear buildup in items that were “Ready to Test” indicating a bottleneck somewhere in the process. I was wondering what was going on… I was under the assumption that the tester did not have any time to test these items (he had some work with existing customers who had to generate some kind of annual reports, so I was waiting for this surge to end). But after asking the tester what was going on he was quite surprised and responded that he only had 12 items that were ready to test instead of the more than 40 shown in the report. After some asking around the root cause of the problem was that the development team did not release a version to the test environment yet so the tester was not able to test the other items.
This example clearly shows that the reporting help you in making bottlenecks visible. However they don’t show you exactly what the root cause is. You always have to keep in mind to See the Whole.
Monday, January 10, 2011
Product Backlog Pareto
Pareto analysis on Product Backlog Items and Bugs
This report helps you analyze the “health” of your backlog for more information:Implementing Lean Software Development: From Concept to Cash (page 170).
Monday, December 27, 2010
Average Cycle Time of Workitems
Find below a query that shows the average Cycle Time per state, you can store the results in a temporary table and join it to provide averages to help in value stream mapping.
The bulk of the work is done by the query below
1: WITH cteStateChange(rowId, tpId, wiId, [State], PrevState, UpdTime) AS(
2: SELECT Row_Number() OVER(Order by wi.TeamProjectSK, wi.System_id, wi.System_Rev)
3: , wi.TeamProjectSK
4: , wi.System_Id
5: , wi.System_State
6: , wi.PreviousState
7: , wi.System_ChangedDate
8: FROM dbo.DimWorkItem wi
9: INNER JOIN dbo.FactWorkItemHistory wih
10: ON wih.WorkItemSK = wi.WorkItemSK
11: AND wih.TeamProjectSK = wi.TeamProjectSK
12: WHERE 1=1
13: AND (wih.StateChangeCount = 1)
14: )
Wednesday, December 22, 2010
Visualize your workflow with Team Foundation Server
I created a custom report for Team Foundation Sever 2010 to visualize your workflow in order to identify bottlenecks
Identify bottle necks
This indicates a bottleneck in testing there is work stacking up for the QA department.
This report will tell you at a glance where to take action.
Inspect Flow
As you see in the picture above no clear “steps” for committed are noticeable in the above chart. The chart below shows a more healthy example.
You also notice that there is an inventory of untested items building up.
Tuesday, November 30, 2010
Keep Assembly version same as build number
Apperantly System.Version is not serializable so the value gets lost when going into the Run On Agent Sequence.
As a startiong point I used the code of Ewald Hoffman. Original Article: http://www.ewaldhofman.nl/post/2010/04/20/Customize-Team-Build-2010-e28093-Part-1-Introduction.aspx
Step 1: Create the Version Generator (+ offcource the necessary unit tests
1: using System;
2: using System.Collections.Generic;
3: using System.Linq;
4: using System.Text;
5:
6: namespace SharpSolutions.Tfs.Build.BuildTasks
7: {
8: public sealed class AssemblyVersionGenerator: IAssemblyVersionGenerator
9: {
10: /// <summary>
11: /// Generatas a new Assembly version
12: /// int the following format: Major.Minor.Build.Revision
13: /// Major: same as current version
14: /// Minor: same as current version
15: /// Build: 2 digit year since 2000* 1000 + day of year eg 10001 = Build run on 1 jan 2010
16: /// Revision: seconds since midnight
17: /// </summary>
18: /// <param name="currentVersion">used to retrieve current major and minor version</param>
19: /// <returns>A new Assembly version</returns>
20: public Version Generate(Version currentVersion)
21: {
22: //If we did not force now use the real now
23: //O_o get it?
24: DateTime now = ((IAssemblyVersionGenerator)this).Now == default(DateTime)? DateTime.Now: ((IAssemblyVersionGenerator)this).Now;
25: int major = currentVersion.Major;
26: int minor = currentVersion.Minor;
27: int build = (now.Year % 2000) * 1000 + now.DayOfYear;
28: int revision = (int)(now - new DateTime(now.Year, now.Month, now.Day, 0, 0, 0)).TotalSeconds / 10;
29:
30: return new Version(major, minor, build, revision);
31: }
32:
33: DateTime IAssemblyVersionGenerator.Now { get; set; }
34: }
35: }
2. Create a new Code Activity. Offcourse you can easily implement your own version of IAssemblyVersionGenerator
1: using System;
2: using System.Activities;
3: using Microsoft.TeamFoundation.Build.Client;
4: using Microsoft.TeamFoundation.Build.Workflow.Activities;
5:
6: namespace SharpSolutions.Tfs.Build.BuildTasks.Activities
7: {
8: [BuildActivity(HostEnvironmentOption.Controller)]
9: public sealed class GenerateAssemblyNumber : CodeActivity<string>
10: {
11: private IAssemblyVersionGenerator versionGenerator = new AssemblyVersionGenerator();
12:
13: [RequiredArgument]
14: public InArgument<string> AssemblyInfoFileMask { get; set; }
15:
16: [RequiredArgument]
17: public InArgument<string> Version { get; set; }
18:
19: [RequiredArgument]
20: public InArgument<IBuildDetail> BuildDetail { get; set; }
21:
22: protected override string Execute(CodeActivityContext context)
23: {
24: string assemblyInfoFileMask = context.GetValue(this.AssemblyInfoFileMask);
25: string version = context.GetValue(this.Version);
26:
27: Version currentVersion = new Version(version);
28: Version newVersion = versionGenerator.Generate(currentVersion);
29: context.TrackBuildMessage(string.Format("New Version is {0}", newVersion.ToString()));
30:
31: return newVersion.ToString();
32: }
33: }
34: }
Step 3: Update the version number in the AssemblyInfo.cs
1: using System;
2: using System.Collections.Generic;
3: using System.Linq;
4: using System.Text;
5: using System.Activities;
6: using System.Text.RegularExpressions;
7: using System.IO;
8: using Microsoft.TeamFoundation.Build.Client
9: using Microsoft.TeamFoundation.Build.Workflow.Activities;
10:
11: namespace SharpSolutions.Tfs.Build.BuildTasks.Activities
12: {
13: [BuildActivity(HostEnvironmentOption.Agent)]
14: public sealed class UpdateAssemblyVersion : CodeActivity
15: {
16: [RequiredArgument]
17: public InArgument<string> VersionNumber { get; set; }
18:
19: [RequiredArgument]
20: public InArgument<string> AssemblyInfoFileMask { get; set; }
21:
22: [RequiredArgument]
23: public InArgument<string> SourcesDirectory { get; set; }
24:
25: // If your activity returns a value, derive from CodeActivity<TResult>
26: // and return the value from the Execute method.
27: protected override void Execute(CodeActivityContext context)
28: {
29: // Obtain the runtime value of the input arguments
30: string sourcesDirectory = context.GetValue(this.SourcesDirectory);
31: string assemblyInfoFileMask = context.GetValue(this.AssemblyInfoFileMask);
32: Version newVersion = new Version(context.GetValue(this.VersionNumber));
33:
34: // Get all AssemblyInfo files
35: foreach (string file in Directory.EnumerateFiles(sourcesDirectory, assemblyInfoFileMask, SearchOption.AllDirectories))
36: {
37: // Read the text from the AssemblyInfo file
38: string assemblyInfoVersionText = File.ReadAllText(file);
39:
40: string updatedContents = Utilities.UpdateAssemblyVersion(assemblyInfoVersionText, newVersion);
41:
42: File.WriteAllText(file, updatedContents);
43: }
44: }
45:
46: }
47: }
Wednesday, November 24, 2010
Team Foundation Server 2010 MDX to exclude the weekends
WITH
SET [WeekDays]
AS Filter(
[Date].[Date].[Date]
, COUNT(WTD([Date].[Year - Week - Date Hierarchy])) <> 1
AND COUNT(WTD([Date].[Year - Week - Date Hierarchy])) <> 7
)
SET [DateRangeFrom]
AS FILTER([WeekDays]
, [WeekDays].CurrentMember.Member_Value >= CDATE("11/17/2010")
)
SELECT {
[Measures].[Work Item Count],[Measures].[Revision Count]
}
ON COLUMNS,{
[DateRangeFrom]
// [Date].[Date].[Date]
// , WTD([Date].[Year - Week - Date Hierarchy].CurrentMember)
//
}
ON ROWS
FROM [Team System]
Monday, January 12, 2009
Team Build and Referenced Assemblies
I am currently building an application that uses several things of Enterprise Library and RhinoMocks for unit testing. Now these references have to be made to fixed locations but this can impose problems when building from different machines (think build agents differebt developer machine setups).
What I did was on my build agent I shared the build folder and mapped a networkdrive to it (in my case s:\). then I created a structure like this:
Enltlib\latest\ to which I copied the complete bin directory from entlib. The big advantages is that if you decide to upgrade later you just rename the folder to v4.1 and create a new latest folder where you copy the latest binaries to. Like this everybody will always be referencing the latest binaries without having to redo all their references in their projects
The advantages of this approach is that its completely independent of your machine setup. And if you have to work offline from your TFS once in a while you just make sure you check out the latest version of your BuildStore share the drive on your local machine and map it to the same network drive and your projects will continue to build without having to redirect the references all the time.
Monday, December 01, 2008
Team Foundation Server 2008 SP1 with SQL 2008
Simply upgrade your Visual Team System 2008 WITH team explorer installed to SP1
Monday, April 14, 2008
Spend some few days setting up a continous integration for a database project. Found some stuff on the internet but they got it all wrong :)
I am using Team Foundation Server 2008.
The only thing you need to do is modify the TFSBuild.proj
Modify the following sections. This enabled the automatic generation of a sql script that will be copied in the Drop Folder.
Find the SoltionToBuild tag and add the properties as shown below:
<SolutionToBuild Include="$(BuildProjectFolderPath)/../../CIDB/CIDB.sln">
<Targets></Targets>
<Properties>DefaultDataPath=C:\BuildDrop\;TargetDataBase=TestDb</Properties>
</SolutionToBuild>
Add the default configuration to the ConfigurationToBuild ItemGroup as shown below (make sure to match it to your settings in the Configuration Manager)
<ItemGroup>
<!-- CONFIGURATIONS
The list of configurations to build. To add/delete configurations, edit this value. For example,
to add a new configuration, add the following lines:
<ConfigurationToBuild Include="Debugx86">
<FlavorToBuild>Debug</FlavorToBuild>
<PlatformToBuild>x86</PlatformToBuild>
</ConfigurationToBuild>
The Include attribute value should be unique for each ConfigurationToBuild node.
-->
<ConfigurationToBuild Include="ReleaseAny CPU">
<FlavorToBuild>Release</FlavorToBuild>
<PlatformToBuild>Any CPU</PlatformToBuild>
</ConfigurationToBuild>
<!--Include the configuration to build this generates a .sql file in the drop folder-->
<ConfigurationToBuild Include="DefaultAnyCPU">
<FlavorToBuild>Default</FlavorToBuild>
<PlatformToBuild>Any CPU</PlatformToBuild>
</ConfigurationToBuild>
</ItemGroup>
Next add the following section to the end of the TFSBuild.proj file. the %3B is the escape character for ';' in MSBuild
<PropertyGroup>
<TargetConnection>Data Source=.%3BIntegrated Security=True%3BPooling=False</TargetConnection>
<DefaultDataPath>C:\BuildDrop\</DefaultDataPath>
<TargetDataBase>DevDb</TargetDataBase>
</PropertyGroup>
<Target Name="AfterDropBuild">
<MSBuild Projects="$(SolutionRoot)\CIDB\CIDB\CIDB.dbproj"
Properties="Configuration=Default;
OutDir=$(SolutionRoot)\..\binaries\Default\;
AlwaysCreateNewDatabase=false;
TargetConnectionString=$(TargetConnection);
DefaultDataPath=$(DefaultDataPath);
TargetDataBase=$(TargetDataBase)"
Targets="ReBuild;Deploy" /> <!—Need to specify the Rebuild target otherwise fails -->
</Target>
Update:
If you modify your source folder setting in the workspace - defaults to $(SourceDir)- make sure that you override your SolutionRoot property
by adding the following
...
</ProjectExtensions>
<PropertyGroup>
<SolutionRoot>C:\Workspace_Build02 </SolutionRoot>
....
Thats all there is to it :)
Coming up automatically generate an upgrade script to deploy to production systems... I installed the Database Team Edition on the build agent but I am not quite sure if its necessary I will investigate this... I dont know if its default part of ms build