Friday, February 24, 2012

Remapping the F5 Key for Debugging VS2010

I use Visual Studio 2010 currently at work. When we switched from MSTest to NUnit I kept getting errors when I hit F5 to run my tests. The desired behavior of F5 changes from time to time in my IDE, so I want to note the steps to change it. I based the steps on an old blog post based on VS2005. The principals remain the same.

  • Open Visual Studio.
  • Click Tools - Options
 

 

 

 

 

 

 

 

 

 
  • Navigate to Environment - Keyboard
  • Keep your mapping scheme the same
  • Type Debug.Start in the Show Commands Containing field.
  • Remove the current shortcut
 


 

 

 

 

 

 
Now if you want to remap F5 to another debugging command:
  • Type in the command in Show Commands (e.g. ClassViewContextMenus.ClassViewProject.Debug.Startnewinstance)
  • Select the context for the override in the Use New Shortcut field
  • Click in the Press Shortcut Keys field
  • Press your desired shortcut key(s)
  • Press Assign
  • Review the conflicts in the Currently Used By dropdown
  • Press OK


 

Tuesday, February 21, 2012

Windows 8 Music

So the music player is integrated into the folder you have music stored in. Navigate to a music track (mp3, wma, flac? maybe). You see context menus appear in the folder. Press the play button and...nothing...yet. These do not yet actually play mp3 tracks, but it is a nice thought. I do not have any flacs or wmas to play (or whatever the crappy format Apple uses). I will assume they all work perfectly. I am glad I moved all my library to the cloud on Google music.

Monday, February 20, 2012

Thoughts on Windows 8 - Part IV - Updates

Not much to say. first mandatory update was pushed. It was advertised days ahead of schedule. There was no obvious way to instantly apply the update. Even though I cycled my laptop several times during the interim period, the update was not applied until the scheduled date and time. I did not try very hard to avoid the update, but there is no graceful solution offered to defer updates at this point in the beta. I doubt this will be indicative of the process that will be implemented in production. I expect a model like the mandatory IE upgrades will be followed, where a setting can override the updates.

Friday, February 17, 2012

Thoughts on Windows 8 - Part III

Couple of topics. Games. Cannot play many of them, as they were designed to demo a touch screen user experience. One of the big shiny things with Windows 8 is support for touch screen interaction on the desktop. It is one of the cool things I cannot develop on a 32 bit system and cannot test on my old laptop. You can work around the touch screen controls with the arrow keys, but it is not the optimized tool for the job.

Browsing. Mixed experience at this point. If you launch IE from the Start screen, it is a very different experience than from the Desktop. The browser you open from the Start page is optimized for a simile user experience, possibly optimized for the touch screen launch experience. None of the menus you would normally use are present in this browser. Add-ons do not seem to be available in this experience.

Wednesday, February 15, 2012

Thoughts on Windows 8 - Part II - The Firefox Edition

Netflix streaming does not work on Windows 8...or does it? I installed Silverlight, fired up Firefox, and wham...I go the system requirements error message. Windows 7 is not listed as compatible. I called Netflix, who directed me to the Microsoft support line, a they felt this was a Silverlight issue. First, the support tech had no idea what Windows 8 was. Secondly, she used an inaccurate support script to talk me through finding some build information. As we went through this, it dawned on me that I was using the Firefox beta, which may not be supported. I opened IE 10 and wham! I was in the video streaming world once again. I told the support person the resoltion and decided to add it here. You can use Netflix with Windows 8 beta with no hackery what so ever (after installing Silverlight). Firefox beta may require some registry editing

Thoughts on Windows 8 - Part I

I installed a preview of the 32 bit edition of Windows 8. This does not include the developer kit, which is exclusively 64 bit compatible. That's something to note for home development purposes. Some basic thoughts here.

The initial landing experience for the pre-beta is new. It reminds me of a poorly executed KDE Linux UI. You land on a page of movable icons. These lack a meaningful organizational structure (like tabs or sliders) to minimize scrolling. Many programs show on the Start page you land on when you first log in. This includes oodles of new widgety goodness. There are fun games (5 in a Row, Tube Rider, and more), an RSS feed reader, a Weather widget (I liked the Windows 7 version better) and more. Oddly Silverlight shows up on this page (once installed), but for some reason Flash (once installed) does not. This makes for a jumbled mess to navigate.

The concept of the Programs menu has morphed. You can access most programs (except Flash) from the Start page. This is accessible using the Window button from anywhere in the UI. You can access those few programs with desktop icons from the desktop. The desktop is still available from any place (non-full screen mode) using one of the Show Desktop controls in the Taskbar (Microsoft, capitalize the names of your major navigational features, it will change the way you think of them). You can navigate to Programs by searching. This is sorta neat. Go to the Start window and type the name of the item you are looking for. No clicking on a search icon, just type. Hovering over the Windows icon allows you to select the familiar Search feature from Windows 7 (his feature is still fiddly). The result list feels more like Linux, in that it is pretty, well organized, and intuitive to navigate. Escape from Search produces a nice Program List that would be nice to access directly from the Start menu (I think the Start menu is still under development in my pre-beta version...what does it mean to release pre-beta to your customers anyway?). You can still use Windows Explorer to find things, if for instance you cannot find Flash player as it is not listed as an App, but under Settings in the Search results.

The Task Manager has undergone a transformation. The Fewer details view is just a list of running apps. No news there. The More details view still needs some chrome. However, the logical grouping of processes by type is nice and the various performance monitoring views are uncluttered and meaningful. I am not sure why performance monitoring is spread across two applications (the Performance Monitor will be more familiar to Windows 7 users). Unless it is a hack for users without elevated permissions, it feels like this would all be best in a single application.

Installation of untrusted applications (like NUnit) requires an additional step now. The ability to install untrusted apps is hidden by default. You have to click the unintuitive "More Details" button to be able to see the Run Now button.

I do not have a means to do benchmark testing. I will simply say that start up, shut down, and execution speeds are not perceptibly different on my underpowered laptop.

Tuesday, February 7, 2012

Negative Testing

Today I was asked to clarify the scope of unit testing. The question was around the idea of negative tests. A fundamental axiom of unit testing is that you perform both positive and negative tests against your method or function. This brought about a good conversation at work. I wanted to capture it for later in life, when I am too thick to think on my feet.

CONCEPT ONE ATOMICITY:
The scope of unit tests is constrained by the scope of the method or function under test. I am going to use just method here after, as it is annoying to refer to both methods and functions. That means certain test scenarios are inappropriate for unit testing. An example test I would not worry about in a unit test would be a data type mismatch test. The method will have a signature that should prevent a float value (a decimal value) from being passed into a member declared as an int (accepts only whole numbers). Only test that which is in the scope of the unit under test. Integration testing should cover issues where a data type mismatch would occur. Another note on atomicity, the smaller the test scope for unit test (focused just on the unit under test) the more granular your test reporting and the faster you can successfully debug and find the root cause of an issue.

CONCEPT TWO NON-DEPENDENCY:
Mock the data used for testing rather than leveraging an external data source, when you can. I have talked around this issue muchas, and I have to say that the more layers of test dependency you inject, the more time you fiddle with your test infrastructure. I am sure there are other reasons (like a greater risk of test inaccuracy) but the time spent managing test resources is my big issue. It has been argued that a 'when you cannot" scenario would be testing a stored procedure with a complex signature requiring configuration data and transactional inputs needs a database to store the inputs and expected values. I would suggest that, if you need this include it as a resource in your database build project and do not reuse the schema from your product. Tying the two schema together also increases time spent managing test infrastructure.

CONCEPT THREE NEGATIVE TEST:
The division method is a classic unit test example. The positive test is to pass in 4/2 and assert that the result is 2. The negative test is to pass in 4/0 and assert that the method under test elegantly raises a divide by zero error. One of the great values of doing unit testing is to engage the developer in the what-if analysis of their code. You can prevent bugs by simply adding comments for each negative test cases prior to writing your method. Given the business requirement "given a comma separated list of last name, first name, and zero or more certifications, store it in the user table. Only store records with first and last names." The positive tests would be (a)parse a single complete record with MD as the credential (b)parse a single record with no credential (c)parse a single complete record with MD. PHD. as the credentials. The negative tests would be (a) pass in a record with a last name and a credential (b)pass in a record with a first name and a credential (c) pass in a record with a last name (d)pass in a record with a first name (e) pass in a record with just a credential. As you see we have more negative scenarios than positive scenarios.