Category Archives: Uncategorized

Running .Net 4.6 Unit tests using vstest.console or TFS builds

Published January 20, 2016 9:29 pm

Unit tests can be authored in VS 2015 and can be targeted to various framework versions e.g. 4.0, 4.5 using the project Target Framework settings. When the framework is set to 4.6 or 4.6.1, you may face a known issue with the vstest.console.exe command line test runner or within TFS (Team foundation server) Builds.

When the tests built using fx >= 4.6 and executed along with another unit test dll that is built with framework version < 4.0 – the runner (vstest.console.exe) is unable to find any tests in the dll. This is because it uses incorrect version of framework in the test host process to discover the tests and hence does not find any tests.

The error may look like this and no tests are discovered.

D:\git\myproj\NetFx46Issue\NetFx46Issue\bin\Debug>c:vstest.console NetFx46Issue.dll Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
Microsoft (R) Test Execution Command Line Tool Version 14.0.24720.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...

Information: Additionally, you can try specifying '/UseVsixExtensions' command if the test discoverer & executor is installed on the machine 
as vsix extensions and your installation supports vsix extensions. Example: vstest.console.exe myTests.dll /UseVsixExtensions:true

In addition, there may be another error if .net frameworks 2.0/3.5 is not installed on the machine and dialogs may popup to install .Net Frameworks 2.0/3.5 windows feature until the command line is aborted with CTRL+C. Capture

Error: The active Test Run was aborted because the execution process exited unexpectedly. To investigate further, enable local crash dumps either at the machine level or for process te.processhost.managed.clr20.exe. Go to more details: http://go.microsoft.com/fwlink/?linkid=232477

The error in XamlBuild or Build vNext environment in a TFS 2013/2015 can be on these lines depending on whether frameworks 2.0/3.5 is installed on the build agent machine or not.

The workaround for this is to use /framework:framework40 switch with vstest.console.exe command line.

D:\git\myproj\NetFx46Issue\NetFx46Issue\bin\Debug>c:vstest.console.exe NetFx46Issue.dll Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll /framework:framework40
Microsoft (R) Test Execution Command Line Tool Version 14.0.24720.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
Passed   TestMethod1

Total tests: 1. Passed: 1. Failed: 0. Skipped: 0.
Test Run Successful.
Test execution time: 13.1705 Seconds

For Xaml build definition, TargetFrameworkVersion=Framework40 setting needs to be passed using a .runsettings file.

  1. Download TargetFrameworkVersion40.runsettings here.
  2. This setting file (TargetFrameworkVersion40.runsettings) needs to be committed to source control along side the test code
  3. Edit the build definition to specify runsettings for the automated test run. Refer msdn for details.
  4. “Source Settings” for the build definition must ensure that the TargetFrameworkVersion40.runsettings file is synced up on the build agent.

For build vnext definition also the steps will be same except the step (3). Runsettings can be specified through the web interface to edit “Visual Studio Test” task’s settings.

The issue will be addressed in VS 2015 Update 2.

Taking an IC role after being in programmer lead role

Published February 4, 2014 3:10 pm

In the last post, we talked about taking a programmer lead role. Once you are in a programmer lead role for couple of years, you may feel the urge to go back to your roots; that is taking IC (individual contributor) role. The reasons can vary:

  1. Lost touch of code because of not coding enough in lead role.
  2. Need to update on new frameworks/concepts since software development goes through paradigm shift 1-2 times in a decade typically.
  3. Need to upgrade my design/architectural/coding skills to next level.
  4. Find the lead role stressful to be responsible for something that you don’t do yourself.
  5. lead role feels like glorified cleric job to divide work and manage delivery.
  6. work-life balance is disrupted. I come the first and leave the last. Work never seems to end.
  7. Writing and delivering people reviews is stressful.
  8. Feel like sandwiched between management and team.
  9. Team health metrics for you are not favoring you in lead role.
  10. For personal reasons, you can’t take up more responsible role for a period.

As far as I can think, reasons typically fall around this. They can be categorized into the following:

  1. Need to upgrade technical skills
  2. Need skills to cope up with lead role
  3. others

For (1) and (2) – there is choice to stay with lead role or go to IC role. For (3) – it is like you have to simply go back to IC role; there is not a choice as such. For example, I have family emergency for a year and need to scope down on work responsibilities. In such case, you and your manager need to work out if there can be different role for you interim. Typically a lead role does not fit part time.

Need to upgrade technical skills

This might be quite stressful if you think your tech skills are rusting and you are struggling to find time to tune them in your role. Lead role has multi-tasking as given and high chance of getting randomized at least in the beginning. Finding your uninterrupted few hours to up your tech skills is a struggle at times. Soon you are getting concerned about it if not losing sleep over it. A techno-manager discipline focused role (dev/test) requires one to be up to date in his tech skills to be respected and deliver business.

There can be many solution for this. Prevention is the best approach. In this approach, you step into lead role – as we talked in the last post – only when you consider yourself ace developer. That means to start with, you have ace tech skills. If not, this approach won’t work for you. Now that you have a good tech skills to start with and say beginner managerial skills, focus hard on your team skills like setting team member goals, negotiation, impact and influence, mentoring and career development, giving feedback, leadership, writing and delivering people performance reviews. code and design reviews – to impart your good practices to team members and add your contribution to project technical deliverables. Each of these skills require their own post to go into detail but we will talk that another day.  First 1-2 years is key when making a transition to lead role – to ace these skills and to graduate out of beginner manager. Feeling uncomfortable at the beginning is being human. but sign of graduation is that you start feeling comfortable with these. e.g. you manage a feedback session as you would write code.

It is good to make time to write code themselves. Start with 3 team members and add slowly. As you get comfortable with managing, you find more time and use it to write code (that implicitly means you get to design also). This does not mean you will not get outdated. but it will take longer and reason to update yourself will be little different in this scenario.

As you move from beginner developer to advanced developer  on IC track, you get to solve more involved technical problems that requires 100%+ focus from a person. As a lead, it is hard to take up such assignments on your plate without stretching++ yourself. For example – taking up performance tuning for a component, security review of the project, prototyping to boot strap a new project. In such cases, it is wise to switch to advanced developer (IC role) for a period. After such project, you are a better lead. People skills don’t rust easily and stay with you longer.

Doing back and forth between IC, lead and M2 role in a discipline is healthy. It builds perspective and keeps you grounded. It requires commitment, hard work, patience and little bit of courage.

Need skills to cope up with lead role

In IC role, you used to do things. In lead role, your b**t is on line for team deliverable and requires you to get things done. It comes with additional ambiguity. First of all, it will need us to be comfortable with higher ambiguity in the system. For example: now it is not only about this-code-does-not-work but about work does not fit schedule, unplanned leave in team etc. Need to plan the work; stretching to meet target won’t work without planning first. After the planning, accept the ambiguity, and deal with it when it comes. Know what you can get done, have some level of buffer, under commit and over deliver vs over commit and under deliver.  Beyond that – Analysis paralysis or scheduling the unknowns won’t work. Basic principles like manage long poles in schedule, load balance, creating backup for team members, schedule risks first so that you have time to react, schedule prototype to iron out technical unknowns before committing to schedule if there is lot of unknowns, prioritize, cut features or buy more time, will help.

Communication is key to team work and deliverables. This is key to pass the right expectation to team. If you have steep target and soft in communicating the urgency – you will feel being sandwiched between the team and your management. It is like management want urgent deliverables and team is conducting business as usual.

Delegation at right level is key. e.g. You can’t delegate division of work and resolving dependencies to your developers. then, you don’t know how deliverables will line up to target date. At the same time – you can’t keep the work of team members with you. You can’t clone yourself and hence, you can only end up doing mornings and late evenings for the unscheduled work – to meet team deadlines. Again, this topic requires much more than one para. but you get the point right?

Change is always hard. Don’t look it through a wrong lenses in the beginning. This will lead to thinking that your work does not help add any value. You are simply a glorified cleric dividing the work among team members. You value addition is through code and design reviews. Further, you can generate able trained developers for the organization. An able dev lead is a factory that generates ace developers. Needless to say – don’t stop coding yourself.

Writing people reviews may come as shocker for some at the beginning. Be objective. Focus on the behavior, results rather than individual. Doing frequent feedback will help not have one marathon annual review. Write detailed feedback. Do one review a day. Keep 1-2 weeks of schedule around annual review to be able to reflect and do good home work before delivering the review.

Personal connection with team is key have good team health. It’s like making time to laugh together by going for a lunch or dinner on an occasion. Across the table, you talk anything from cricket, movies, music to physics. You get to connect as team. You open up to each other to discuss things. Every individual is a human apart from developer. A manager role is to marry business to people. You need to know their aspiration, and constraints; guide, and mentor them. One need to see how work is adding to his skills and growth apart from delivering business. These are basics of team health. Again – this requires much more discussion than one para. Nevertheless, one need to be little more than a nerd – a little social being to build team health.

In summary, moving between IC, lead and M2 (second level manager) roles is healthy to build perspective and good to consider doing this. Lead/manager role requires honing people/team skills which needs attention and action when taking the role first time. Good luck to you to be an ace IC, lead and M2 . Keep rocking! Next time – we talk about whether to take a programmer role for life time career?