Continuous Learning and Sharing of Team Foundation Server and Application Lifecycle Management RSS 2.0
# Wednesday, November 26, 2014

The Kanban board in TFS 2013 allows each team to have their own custom Kanban board.  Each team can customize the columns displayed and map them to appropriate states.  However, beyond the cumulative flow diagram (CFD), these custom columns can not be used with queries or reports.  In order for the columns to be included in reports and queries, the work item states need to be modified to represent the columns.  By specifying the custom states, this typically forces all of the teams to use these states.  Teams will usually want their own states. 

One way I found to allow teams to define their states and have them show up for reports and queries is to create a separate work item for the Kanban boards that contains the superset of all of the states for all of the teams.  Each team can select the applicable states and only those states would show up in reports, charts, and the CFD.  I prefer to create an additional work item such as Card or Support Item instead of modifying the User Story and use it in the Kanban board because the current user story states work well for Scrum and we want to be able to use Scrum and Kanban from the same Team Project. The new work item will need to be added as a requirement and added to backlog.  There is a great article on MSDN explaining the steps for this.

For example, let’s assume Team A and Team B want the following states below.  Some are shared by both teams but others area only used by Team A.  The superset of these states would be added to a custom work item similar to (usually copied from) the User Story. In the state workflow, you would want to create transitions between all combinations of states to allow teams to move between any possible combination of states that each team wants to utilize.  

Team A Team B
New New
Release Ready  
Prioritized Ready Prioritized Ready
Prioritized Prioritized
Analysis Active  
Development Ready Development Ready
Development Active Development Active
Test Ready Test Ready
Test Active Test Active
UAT Ready  
UAT Active  
Closed Closed

 

Each team can customized their own Kanban board to use the columns they want.  Reporting by team will only show the states that each team uses.

clip_image001

I haven’t had a chance to verify every aspect of this but possible downsides could include:

  • Opening the work items will show all of the states.  There is no way to filter just for the team.
  • With multiple work item types available for the Kanban board (User Story and new work item) with different states, the columns have to be mapped/hidden before it will display properly.
  • I might not be thinking of everything from a reporting standpoint.

Let me know if you have any feedback or find any holes in the approach.

Mike

Wednesday, November 26, 2014 12:37:00 AM (Central Standard Time, UTC-06:00)  #    Comments [0] -
ALM | Kanban | TFS

# Tuesday, August 05, 2014

The Visual Studio Online REST APIs provide rich access to integrate and extend the functionality of the Visual Studio Online (VSO).  The VSO REST API allow for almost any type of client application to communicate with it.  To access the VSO REST APIs, there are two types of authentication, Basic Authentication and OAuth 2.0 that are provided.  Basic authentication is very simple to implement but requires the calling application to store the username and password of the user’s VSO alternate credentials.  Each call to the VSO REST APIs require the username and password to be passed with it.  OAuth 2.0 allows for federated access and that the user will authorize your application to access VSO on that user’s behalf.  One of the key benefits of this is that your application will never need to store and pass a password for your application to access the VSO APIs.  Instead the user will receive both an Access Token and Refresh Token.  The Access Token is valid for about 15 minutes and is what is required to send with each VSO API call.  The Refresh Token needs to be persisted and used to renew the Access Token after it expires.

This post focuses on creating an Authorization Filter to leverage a reusable component for your ASP.NET MVC application when connecting to the Visual Studio Online REST APIs.  To learn more about connecting to the VSO REST API, how to address common integration and extension scenarios, and access to the full source control for this sample and a Portal Class Library for connecting to the REST API, take a look at this book by Jeff Bramwell and I, Extending Team Foundation Server and Visual Studio Online.

image

Once an application has been linked to VSO and the user has authorized access, you application must implement the process above to access VSO to retrieve the list.  In this simple example I am not using any kind of site authentication.  I am using a Guid in a cookie for storing a key back to the user table that contains the Refresh Token.  In my next post, I will replace this Guid with Individual Account authentication using ASP.NET Identity 2.0 and federation using Google/Microsoft accounts.  The method below retrieves a list of Team Rooms and displays it in a view.  the is accomplished in the last two lines of code.  The other lines of code are to implement the process in the diagram above.

image

This is a lot of code that will need to be repeated for each action that calls the VSO REST API.  One way to make this reusable and to keep the controller action clean is to use an ASP.NET MVC Action Filter.  These filters can be called at the controller level or action level.  In this case we are going to use an Authorization Filter.  An Action Filter is implemented as an attribute.  You can create one by inheriting FilterAttribute and implementing the IAuthorizationFilter interface.

public class VsoAuthorizeAttribute : System.Web.Mvc.FilterAttribute, System.Web.Mvc.IAuthorizationFilter 

Moving the code to use the filter is mostly straight forward.  Implement the OnAuthorization method passing an AuthorizationContext object.  This context provides access to the cookies and session objects.  However, even though you can retrieve the controller objects, it doesn’t have access to the RedirectToAction method because it is protected.  You can create a CollectionBase object and implement it as a public method so it can be accessed it from the filter.  Below is the Authorization Filter.

 

image

To implement the Authorization Filter, simply add the attribute to each controller action that requires access to the VSO REST APIs.  The filter will be execute before the method and validate that there is a valid Access code before executing the details of the method.  Even if the application needs to redirect the user to the authorization or renew actions, the ReturnUrl parameter will return the user back to this action once they have a valid Access Token.

image

Tuesday, August 05, 2014 6:43:00 AM (Central Daylight Time, UTC-05:00)  #    Comments [0] -
ASP.NET | eBook | TFS API | Visual Studio | Visual Studio Online

# Monday, August 04, 2014

Jeff Bramwell and I are pleased to announce the first major update to our book, Extending Team Foundation Server and Visual Studio Online.  Back in May we published the initial release and we have since been working on our these next two chapters.  We had planned to release more often but the summer has been busy with family fun and vacations.  Thanks for your patience and we will continue to release additional chapters as we complete them and Microsoft releases new REST APIs for VSO.

image

This release includes a number of fixes and two additional chapters:

  • Chapter 15 – Service Hooks – Configure specific events in Visual Studio Online to send information to one of many supported services such as Trello or to a customer service.
  • Chapter 17 – Using OAuth – Leverage OAuth authentication that doesn’t require storing user credentials in your application to communicate with the Visual Studio Online REST APIs.

Don’t forget the book includes fully functional sample code showing you how to access the VSO REST API included a Portable Class Library (PCL) client library for accessing the service across any number of .NET Platforms.  The client library has been updated to support OAuth authentication and there is a new sample Web Hooks project demonstrating how to receive events from VSO.

If you have already purchased the book, thank you! You should have received notification of the update.  If you haven’t purchased it yet, you can still buy it at the discounted price of $4.99.

Feedback has played a major role in this process and we hope to continue this to help ensure we are releasing the book that you want and need.  Please tell us what you think so far and the types of projects you are developing using the VSO REST API and the book at our feedback forum.

Mike

Monday, August 04, 2014 8:25:00 AM (Central Daylight Time, UTC-05:00)  #    Comments [0] -
eBook | Team Foundation Server | TFS API | Visual Studio | Visual Studio Online

# Wednesday, June 04, 2014

Microsoft has just made Visual Studio 14 CTP available to the public to try out the new features such as ASP.NET vNext and the new Roslyn compilers.   Microsoft wants your feedback to let them know what you like and don’t like.

Links

Downloads: Download the Visual Studio “14” CTP (also available on MSDN subscriber downloads). Alternatively, save some time and use the provided VM in Azure.

Blogs & Release Notes: Read announcements by Soma & Brian. Check out the team blogs, including Visual Studio, Web Dev (web tooling), Web Dev (ASP.NET vNext), Entity Framework, C#, VB, and C++. See the Visual Studio “14” CTP release notes for a list of new features. Discuss on Facebook & Twitter.

Known Issues: This release should be installed in a test environment, such as a VM or a clean machine. Do not install on a machine with another version of Visual Studio installed. For other known issues, please see the Visual Studio “14” CTP KB.

Feedback: Submit bugs through Connect, suggestions on UserVoice and quick thoughts through Send-a-Smile in the Visual Studio IDE.

The is an early CTP so don’t install on a production machine or one that has another version of Visual Studio.  Therefore, your two best options are to download Visual Studio 14 CTP and install it on a Virtual Machine or try it out by spinning up a new VM from the Virtual Machine Gallery on Microsoft Azure.  Don’t forget if you have an MSDN license, you get free credits towards Azure each month.  Sign up now and try it out. 

Visual Studio 14 CTP in the cloud

We’ve all downloaded and installed a version of Visual Studio in the past, so let’s see how easy it is to get Visual Studio 14 CTP up and running in Azure.

After you have signed up for an Azure account, launch you browser to http://manage.windowsazure.com (or http://portal.azure.com if you want to check out the new portal interface).  Click the plus in the bottom left corner to begin creating the new virtual machine.

image

From the New menu select Compute > Virtual Machine > From Gallery

There are a number of pre-configured images to speed up your deployment time.  Depending on your account, your list may vary.  How cool is this to be able to run Visual Studio in the cloud?! Imagine, you can use Visual Studio from your IPad! Oh wait, there isn’t a keyboard or a mouse.  Maybe we better stick to running it in the cloud from our Surface. How can I access my source control? Oh yeah, that is in the cloud too on Visual Studio Online!

image

Ok, once you select the Image you want to use, give the VM a unique name.  Also select the Tier.  I recommend choosing the Basic Tier since you don’t need any high availability type features and I’m sure you want to stretch your monthly credits as long as possible. Next provide the size, username, and password.

 

SNAGHTML35f80f2

Select whether to add this to an existing cloud service or a new one.  I chose to create a new cloud service.  Also give it the DNS name, probably keep it the same as your machine name to keep it simple. Choose a region close to where you are located.

SNAGHTML36a9000

Last, keep the defaults unless you want to configure any additional extensions.

image

You will see it starting up and provisioning. 

SNAGHTML36d070b

Once it is ready, choose connect to open the RDP connection.

image

Starting Visual Studio 14 CTP!

image

Create your new project and run!

image

Don’t forget to send a smile to the product team and let them know what you think!

image

Wednesday, June 04, 2014 10:40:00 PM (Central Daylight Time, UTC-05:00)  #    Comments [0] -
Visual Studio | Visual Studio Online | Windows Azure

# Monday, May 19, 2014

Last week, at TechEd North America, Microsoft announced the availability of a new API being provided by Visual Studio Online. This API is based on REST, OAuth, JSON, and Service Hooks. While this new API is still in preview mode there is still a lot of functionality that can be taken advantage of by your imagecustom applications.

While a great deal of documentation is being provided by Microsoft, I and Jeff Bramwell (a fellow Visual Studio ALM MVP) have started writing a book on this very topic titled “Extending Team Foundation Server and Visual Studio Online”. The primary focus of this book will be to provide scenario-based examples on how to utilize the new REST-based APIs and Service Hooks. Based on our everyday experiences with TFS and Visual Studio Online, along with feedback from our readers, we plan to provide a book that will be simply indispensible for anyone wishing to extend TFS or Visual Studio Online using the new API.

Our intention is to release the book in stages, as we complete new chapters. As of this posting, we are officially making the initial version available with planned releases roughly every two weeks – until the initially defined table of contents has been completed. This model will also allow us to address changes and updates to the API as Microsoft moves from preview to release.

To accommodate the phased release, we will be publishing the book as an eBook in PDF, ePub, and MOBI formats. The initial cost of the book will be $1.99 and the price of the book will gradually increase as we release new content. Once you purchase the book, you will get all future releases at no additional charge. So, the earlier you buy in, the better the price!
The initial table of contents for the book is as follows (though subject to change):

Foreword
Introduction
    Part I – The Basics
        Chapter 1: Overview of Team Foundation Server
        Chapter 2: A History of Team Foundation Server APIs
        Chapter 3: A REST Primer
    Part II – Using the Team Foundation APIs
        Chapter 4: Our First REST API Call
        Chapter 5: Work Items
       Chapter 6: Team Foundation Version Control
        Chapter 7: Git
        Chapter 8: Build Definitions
        Chapter 9: Builds
        Chapter 10: Workspaces
       Chapter 11: Team Room Management
        Chapter 12: Team Room Activities
        Chapter 13: Reporting and Charts
        Chapter 14: Projects and Teams
        Chapter 15: Service Hooks
    Part III – Other Resources
        Chapter 16: Using Fiddler
        Chapter 17: Using OAuth
        Resources

The chapters listed in bold have been at least partially completed and are included in the initial release of the book.
If you have an interest in extending Team Foundation Server and/or Visual Studio Online, then this is (will be) the book for you. Purchasing the book now locks in all future updates for only $1.99!

You can read more about the book and purchase it here. Please utilize the feedback section on the book site if you have any questions and/or suggestions. We welcome any and all feedback – especially if it helps us to provide a better, and more useful, book for everyone.

Monday, May 19, 2014 5:24:00 PM (Central Daylight Time, UTC-05:00)  #    Comments [0] -
eBook | TFS | TFS API | Visual Studio Online

# Sunday, April 06, 2014

In Team Foundation Server 2012, Microsoft introduced a tool for helping teams forecast how many iterations a project will take and show which stories will fall into each of those iterations.  It also provides a simple way adjust the target velocity to try multiple values.  Use this along with the drag and drop ordering of the backlog and you can also see how the priority will affect the forecast. There are a few things to understand with the tool to make sure you get the most out of it. In this post I’ll explain why to use the forecasting tool and explain 5 tips so you don’t try to use the tool for beyond the intention.

So why use the forecasting tool? I can assign all of the stories to each Iteration.  Depending on how many stories this will be quite a task.  Also, especially at the beginning of the project, the velocity, or number of stories to be completed each iteration, will be difficult to predict.  If you estimate your team will have a target velocity of 30 and then decide you think it might be 36, you would need to move the stories for each iteration.  Furthermore, the backlog is going to change when new stories and changes to existing stories are made that will cause a lot of rework.  This is where forecasting is extremely helpful.  This is a lightweight tool that was originally released in TFS 2012 web access agile planning tools and has been updated slightly in TFS 2013. 

To use the forecasting tool, select the stories backlog for any team in your team project (#1).  Then turn the Forecast tool on (#2).  The backlog will immediately show how many user stories will fall into each iteration.  Adjust the target velocity (#3) to see how it affects the iterations.  Follow the 5 tips below to get most out of the feature and understand the way it works.

image

Tip #1 - If the iteration has started, it doesn't show in the backlog but stories do.

One of the first things that you might notice is that your current iteration doesn’t show in the iteration forecast.  This might cause some confusion looking at the backlog on the first day of an iteration. You must pull the stories into the iteration and commit to them the forecast before it shows correctly.  However, committing to the stories still might not look like what you would expect.  See Tip #2.

Tip #2 - Stories that are not closed still show in the backlog but if they are active, the points no longer count as part of the forecast.

As I described above, I have pulled the user stories into Iteration 1 and moved the state to Active.  The user stories will show in the list until they are closed but the points do not count in the forecast.  If you used the tool in TFS 2012, you probably noticed this behaves differently.  In TFS 2012, once you moved the story to Active, the story wouldn’t show on the list anymore.

image

Tip #3 - Left over points roll over to the next iteration can be used by the next iteration.

This one caught me off guard and I would say is the most controversial feature.  If the forecasted iteration is less than target velocity because the next item would put it over, the tool will use those points for the next iteration.  This assumes you would always pull in stories once the others are completed to consistently get the same velocity completed even though you wouldn’t credit until those stories are completed in the following iteration. 

Tip #4 – A story with story points larger than the target velocity excludes the iteration because nothing will be complete that iteration.

If you are small team or using large story points, you might see Iterations that are missing in the forecast because the story points are too large and technically nothing will be completed that iteration.  Notice how Iteration 4 is missing because there is a 13 point story when then the target velocity is 10.

image

Tip #5 – Forecasting is just that.  Don’t try to use it for full blown scheduling tool.

As you have seen there are a few behaviors with forecasting that might keep you from wanting to use it for the release schedule. If you use fall through or hardening iterations, you can’t assign zero or a limited velocity for those iterations to allow for fall through stories or unidentified technical debt stories.  Understand the intention and the limitations and it will be useful for forecasting your future iterations. This is intended to show how long and what will be completed in each iteration when the effort completed each iteration matches the target velocity.

Sunday, April 06, 2014 6:40:00 AM (Central Daylight Time, UTC-05:00)  #    Comments [0] -
Agile | ALM | Team Foundation Server

# Thursday, March 20, 2014

The 4th Annual Nebraska Code Camp is a little over a week away and Deliveron is proud to support it again this year.  This community-driven developer conference hosts 200+ attendees each year and is free to attend on Saturday. NECC draws great speakers from around the country and this year even internationally with the keynote speaker, Iris Classon.  There is still time to register.

Deliveron has been a sponsor of NECC for the past 3 years and has spoken at it every year.  We will have our booth there again this year so stop by to learn more about Deliveron, job opportunities, any help you need with projects, or just to say hi!  The schedule is packed with informative sessions for all levels from middle/high school to advanced.  Also come attend talks by two of Deliveron’s consultants, Andy Bayer and Mike Douglas. 

Andy Bayer will talk to us about Maintainable Unit Tests - that's an oxymoron right? (Saturday 3:15).  Here is what to expect:

Given the fact that everyone is writing unit tests for their code (that's a fact right?), that must mean we are all totally happy with the amount of maintenance unit tests can be. I personally really enjoy making a one line code change and have to fix 100+ unit tests before my solution will even build - makes my day every time. Now back to reality - there are a few simple patterns that you can implement to shield your unit tests from being impacted by code changes, yet still make them flexible enough to test what you need to test. I'll be using moq for my samples, but the patterns will work with whatever mocking framework you prefer.

Mike Douglas is giving two workshops on Friday and one talk on Saturday.

Developer Productivity ALM Delivery (Friday 8:00 to 12:00)

Visual Studio is packed with so many features and tools, how do you learn about them and know which ones to use? Once you do decide you want to use a tool, how do you provide guidance so that everyone uses it consistently? Are there ways to track and measure that developers are following the process and be able to correlate this to the overall health of the application and project?

In this workshop attendees will learn to use Visual Studio tools and features for each step of the process from design to delivery with hands on labs using the features in Visual Studio. I'll walk you through the Developer Productivity ALM Delivery guidance documentation we have created for internal projects and for help our clients. In addition we will discuss how to track the process and provide a quality review process where all developers can understand how they are doing for each Iteration.

 

Agile Planning from Teams to Enterprise with Team Foundation Server 2013 (Friday 1:00 to 5:00)

 

Sticky notes keep falling of your task board? Wondering how you can quickly shift work between teams? Team Foundation Server 2013 introduces a number of improvements including backlog management, task boards, agile portfolio management, Kanban, and various reporting improvements.

In this workshop attendees will learn how to capture user stories, manage multiple team backlogs, view the teams progress rolled up to department or enterprise level. Attendees will also learn about the Kanban tools and other improvements to help support planning through a simple to use web interface for the entire team. There will be a series of hands on labs for using these features in TFS 2013 Web Access, with access we will provide through the Internet. We will finish with a look at what is coming in the TFS 2013 Update 2 release including improvements for work item tagging, Kanban, and web charting.

 

Developer Productivity Improvements in Visual Studio 2013 (Saturday 4:30)

 

With every new version of Visual Studio, Microsoft introduces a number of features designed to allow you do more in less time while improving the quality. In this talk I will go through a number of these features that help improve developer quality and productivity, and help understand code. Features include Visual Studio IDE improvements, using Code Lens and Code Map to understand the code quickly. Also, I will go through tools that can help track and measure the quality of your application over time. Last, I will wrap up by going through recent productivity improvements for suspend/resume, code reviews, and Team Rooms.

We hope to see you there!

Thursday, March 20, 2014 5:21:00 PM (Central Daylight Time, UTC-05:00)  #    Comments [0] -
ALM | Deliveron | Nebraska Code Camp | Visual Studio

# Friday, March 14, 2014

Thanks to a lot of great feedback, I have released some minor updates to TFS Agile Poker.  Changes include:

  • Upgraded to support Windows 8.1
  • Made backlog items columns resizable and increased the number of items to 50 per page
  • Added Copy Invite to clipboard feature so you don’t have to set up the mail store app
  • Fixed connection refresh issue if connection information is changed on the getting started page
  • Changed TF Service to Visual Studio Online

I have more features to implement. Look for some more updates in the coming soon.

www.tfsagilepoker.com

image

image

Friday, March 14, 2014 7:42:00 AM (Central Daylight Time, UTC-05:00)  #    Comments [0] -
TFS Agile Poker | Windows 8.1

# Saturday, September 28, 2013

My main developer PC (Windows 8) had been running slow lately so I decided to wipe the drive and perform a clean installation of Windows 8.1.  I have been running the Windows 8.1 preview on my Surface Pro for the past couple months and I love the improvements.  Most of the improvements are subtle but make using Windows much more user friendly.  This time I’m going to try to be more selective in what I install on it and use Virtual Machines for most of the development so I don’t slow down my host.  So far the laptop has been incredibly fast.  I decided to install Visual Studio 2012 (and installed Update 3) on my host because there are a lot of times I need to access TFS or create a sample project and I don’t necessarily want to have to start one of my VMs.  When I tried to create an ASP.NET MVC 4 application I was prompted with these two error messages.  I was able to get both resolved but I thought I would post this in case anyone else runs into this.

The first dialog prompted me that

Configuring Web http://localhost:8547/ for ASP.NET 4.5 failed. You must manually configure the site for ASP.NET 4.5 in order for the site to run correctly.  ASP.NET 4.0 has not been registered on the Web server. You need to manually configure your Web server for ASP.NET 4.0 in order for your site to run correctly.

image

Most of the posts suggested deleting the IISExpress folder under documents because it recreates it the next time an application is run.

image

I deleted the folder, reran Visual Studio but I still received the same error.  I repaired .NET Framework 4.5 as shown below and it fixed that message.

image

When I tried to open the solution after I fixed the first error, the following dialog still displayed. 

ASP.NET 4.5 has not been registered on the Web server. You need to manually configure your Web server for ASP.NET 4.5 in order for your site to run correctly.

image

I had received similar messages in the past working with previous frameworks.  My first thought was to go to a command prompt and register .NET 4.5 with IIS.  I ran aspnet_regiis and received the following message.  It look like now in Windows 8/8.1, this is a Windows Features option.

This option is not supported on this version of the operating system.  Administrators should instead install/uninstall ASP.NET 4.5 with IIS8 using the “Turn Windows Features On/Off” dialog, the Server Manager management too, or the dism.exe command line tool.

image

Using the handy Windows-X key combination I selected the Programs and Features dialog.  I chose Turn Windows features on or off and the dialog appeared.  I expanded the .NET Framework 4.5 Advanced Services and selected ASP.NET 4.5.  Everything worked after that!

image

Note:  This is also required on Windows 8 but I didn’t have to do this manually when I installed Visual Studio 2012 on Windows 8.  I’m also not sure if installing Visual Studio 2013 will automatically select this.

-Mike

Saturday, September 28, 2013 6:12:00 AM (Central Daylight Time, UTC-05:00)  #    Comments [0] -
ASP.NET | Visual Studio 2012 | Windows 8.1

# Tuesday, August 13, 2013

ADFS, or Active Directory Federated Services, is Microsoft’s implementation for claims based authorization and authentication with Windows Domains. This allows companies to share or federate their security with other organizations that they trust.  This is already prevalent across the web in how you can use your Facebook, Google, or Microsoft account to login to other websites because those credentials have been issued by a trusted identity provider.

When using an ADFS enabled website (called Passive authentication), the first time you access the site, it will automatically redirect to the identity provider.  AFDS in this instance creates the user authenticated token and redirects the user back to the website with a cookie that you have been successfully authenticated.  Subsequent calls will use the token to prove you have already been authenticated and not require the redirect to ADFS until the token is not longer valid.

The web performance tests and load tests will also need to follow the same path and authenticate to ADFS on the first call and not on subsequent calls.  When you create a Web Performance Test it will succeed against ADFS because it records the ADFS authentication steps, however when you try to run it multiple times in a load test, it will fail because it no longer follows the same path because the token is already present.  There are probably several ways to accomplish this but there isn’t a lot on the web for this.  This solution to making the load tests work is to turn the Web Performance Test into a Coded Web Performance Test and then create a condition to check for the FedAuth cookie to decide whether or not to the user is authenticated.  Here are the steps for accomplishing this.

1. Capture Test

When you create a new Web Performance Test, a web browser widow is opened with the recorder already recording.  Paste the URL into the browser, display the page and any subsequent requests, and then stop the recording.  This will create the set of HTTP calls.  Run the test to verify that it passes.

2. Create the Coded Web Performance Test

Click on the Generate Code button and give it a name.  I usually accept the default name.  I also organize the Coded tests and regular ones into separate folders for better organization.

image

Next run the test to still make sure it works.  In Visual Studio 2012, right click within the test and choose “Run Coded Web Performance Test” from the context menu.  These tests will not run from the “Run Tests” option like Coded UI Tests or Unit tests.

clip_image001

3. Create the Load Test                 

Create a basic Load Test with the following settings:

  • Load Pattern: Constant Load w/ 1 user
  • Test Mix: Add the Coded test from step 2.
  • Run Settings: Change to Test iterations and set the value to 2 iterations.

Run the test and you will see one success and one failure.  You should see something like the following two errors:

  • https://myserver.mydomain.com/Customers/Order/Edit/11111              Validation Rule Error       ValidateResponseUrl     The value of the ExpectedResponseUrl property 'https://ststest.mydomain.com/adfs/ls/auth/integrated/' does not equal the actual response URL 'https://myserver.mydomain.com/Customers/Order/Edit/11111'.  QueryString parameters were ignored.               -              Test log               
  • Context parameter '$HIDDEN1.wa' not found in test context                     

Both of these are due to the fact that it is expecting to be redirected to the ADFS server but wasn’t because it was already authenticated.

 

5. Create Conditional Rule for the FedAuth cookie

To fix this, we need to create a conditional rule to check for to see if the FedAuth cookie is already present and not redirect to the ADFS server.  Create the Conditional Rule before the request1 statement and add a BeginCondition call before it.

CookieExistenceRule conditionalRule1 = new CookieExistenceRule();
conditionalRule1.Webpage = "https://myserver.mydomain.com/Customers/Order/Edit/11111";
conditionalRule1.CookieName = "FedAuth";
conditionalRule1.CheckForExistence = true;
conditionalRule1.CookieDomainName = "";
conditionalRule1.CookiePath = "";

this.BeginCondition(conditionalRule1);

WebTestRequest request1 = new WebTestRequest("https://myserver.mydomain.com/Customers/Order/Edit/11111");

6.  Add Execute Conditional Rule before the the expected result for request1

This can vary slightly based on your test.  As you will see in this example, there are two places to add the ExecuteConditionRule but I had other tests where there was just one location.   I also ran into instances where I needed to add an else and had to set the ExpectedResponseUrl to the correct page and not the ADFS server.  This may require some trial and error before getting it correct.

if (!this.ExecuteConditionalRule(conditionalRule1))

{

                request1.ExpectedResponseUrl = "https://ststest.mydomain.com/adfs/ls/auth/integrated/?wa=wsignin1.0&wtrealm=http" +

                "s%3a%2f%2fmyserver.mydomain.com%2f&wctx=rm%3d0%26id%3dpassive%26ru%3d%252fCustomers" +

                "s%252fOrder%252fEdit%252f11111&wct=2013-08-06T16%3a11%3a06Z";

                ExtractHiddenFields extractionRule1 = new ExtractHiddenFields();

                extractionRule1.Required = true;

                extractionRule1.HtmlDecode = true;

                extractionRule1.ContextParameterName = "1";

                request1.ExtractValues += new EventHandler<ExtractionEventArgs>(extractionRule1.Extract);

}

yield return request1;

request1 = null;

 

7. Add Execute Conditional Rule to any other calls where the ADFS Server is the referer.

Not all tests will have this.  In this case request4 has a referer header from the ADFS server.  Add the conditional rule to after the request statement.  Include an else statement and set the ExpectedReponseUrl to the “default” URL when you access the site. 

WebTestRequest request4 = new WebTestRequest("https://myserver.mydomain.com/");

if (!this.ExecuteConditionalRule(conditionalRule1))

{

                request4.Method = "POST";

                request4.ExpectedResponseUrl = "https://myserver.mydomain.com/Customers/Order/Edit/11111";

                request4.Headers.Add(new WebTestRequestHeader("Referer", "https://ststest.mydomain.com/adfs/ls/auth/integrated/?wa=wsignin1.0&wtrealm=http" +

                "s%3a%2f%2fmyserver.mydomain.com%2f&wctx=rm%3d0%26id%3dpassive%26ru%3d%252fCustomer" +

                "s%252fOrder%252fEdit%252f11111&wct=2013-08-06T16%3a11%3a06Z"));

                FormPostHttpBody request4Body = new FormPostHttpBody();

                request4Body.FormPostParameters.Add("wa", this.Context["$HIDDEN1.wa"].ToString());

                request4Body.FormPostParameters.Add("wresult", this.Context["$HIDDEN1.wresult"].ToString());

                request4Body.FormPostParameters.Add("wctx", this.Context["$HIDDEN1.wctx"].ToString());

                request4.Body = request4Body;

}

else

{

                request4.ExpectedResponseUrl = "https://myserver.mydomain.com/leaders";

}

this.EndCondition(conditionalRule1);

Add the EndCondition statement after the last closing bracket of the the last conditional rule. Ensure this is only called once and it is after the last conditional rule or the test will fail.

 

 

8. Rerun the Coded Web Performance Test

Repeat step 2 and rerun the Coded Web Performance Test.  Verify that the test is passing. 

9. Rerun the Load Test

Rerun the Load Test that you created in step 3.  Both iterations should pass now.  You can add more instances and/or users to test the system under load.

Additional Items

1. If you notice any calls to https://urs.microsoft.com/urs.asmx, this is caused by the smartscreen filter being turned on in IE.  I would recommend removing these calls and disabling it in IE.  This was being called multiple times within a test and taking 40+ seconds to the test.

2. If you test contains a number of AJAX calls consider turning off the think times.  This can be done and the scenario step of the wizard or in the properties under scenario. 

Tuesday, August 13, 2013 6:42:00 AM (Central Daylight Time, UTC-05:00)  #    Comments [0] -
ADFS | Load Testing | Visual Studio 2012

Visual Studio ALM MVP
Microsoft Visual Studio ALM MVP
Archive
<December 2014>
SunMonTueWedThuFriSat
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910
Blogroll
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2014
Mike Douglas
Sign In
Statistics
Total Posts: 102
This Year: 8
This Month: 0
This Week: 0
Comments: 90
All Content © 2014, Mike Douglas
DasBlog theme 'Business' created by Christoph De Baene (delarou)