Shortcut keys for running tests in Visual Studio
One of my most used shortcuts in Visual Studio is CTRL+R,T to debug the current test method from the code and CTRL+R,A to execute all tests. Here’s the help topic: How to: Run Selected Tests
To run tests from your test code file, by using the keyboard
1. In Visual Studio, open the source-code file that contains your test methods.
2. Click to define the testing scope: Place the cursor in a test method, in a test class, or outside the scope of a test class.
3. You can use the following keyboard shortcuts to run tests based on that scope.
CTRL + R, then press T This runs the tests in the current scope. That is, it runs the current test method, all the tests in the current test class, or all the tests in the namespace, respectively.
CTRL + R, then press C This runs all the tests in the current test class.
CTRL + R, then press N This runs all tests in the current namespace.
To run tests from source code files in your solution, by using the keyboard
1. In Visual Studio, open a source code file anywhere in your solution.
2. You can use the following keyboard shortcuts to run tests from that file.
Ctrl + R, then press A Runs all the tests in all test projects.
Ctrl + R, then press D Runs all tests that were run in the last test run.
Ctrl + R, then press F Runs all tests in the last test run that did not pass.
HowTo update appsettings programmatically
Recently I was writing functional test for an application that read settings from the appsettings element in App.Config. The problem was that the application under test was expecting to react different based on the settings so need a way to alter the values between tests. I ended up writing bellow code for it
private static void SetAppSettings(string key, string value) { Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.AppSettings.Settings[key].Value = value; config.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection("appSettings"); } |
Scrumy on Softpedia
Today I happen to find out that Scrumy have been added to Softpedia’s library of software. It’s nice to see that people are interested in my project and that they have even rated it with 5 stars.
http://www.softpedia.com/get/Programming/Components-Libraries/Scrumy.shtml
Connect to multiple NST with RTC
If you are in a situation where you are switching between different NST on daily basis and are getting tired on changed server from RTC every time, here is the solution. You can create different RTC configuration files per NST.
Step by step for windows 7
1. Copy the C:\Users\”user name”\AppData\Roaming\Microsoft\Microsoft Dynamics NAV\70\ClientUserSettings.config file to a directory you like
2. Update the newly copied configuration file
For example:
<add key=”Server” value=”[NSTSERVER]” />
<add key=”ServerInstance” value=”[second instance]” />
<add key=”ClientServicesPort” value=”7048″ />
3. Right click on the desktop and click on New->Shortcut
4. Brows to the installation directory for RTC. Example : “C:\Program Files (x86)\Microsoft Dynamics NAV\70\RoleTailored Client\Microsoft.Dynamics.Nav.Client.exe”
5. Click Next
6. Change the name of the shortcut if needed
7. Click Finish
8. Find the newly created shortcut on the desktop and right click on it and pick properties
9. Update the “Target” to for example: “C:\Program Files (x86)\Microsoft Dynamics NAV\70\RoleTailored Client\Microsoft.Dynamics.Nav.Client.exe” -settings:”C:\\.config“
10. Click Save
11. Now you can easly connect RTC to any NST you want by simple clicking on right shortcut.
Extra tips
If you want to add the shortcut to the start menu. Simply copy the newly created shortcut from the desktop to C:\Users\”user name”\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
Share source files between Visual Studio projects
After some time developing software you naturally start to repeat yourself and solve the same problem over and over again. If you could simple share this implementations between all your solution’s, you would save a lot of time. On common way to share source code between different project is to create separate tool/”good to have code” assembly and simply include this project or assembly into every solution. Many times I find this very heavy weighted and overkill. But the big problem according to me is that you have expanded the attack surface of your application, by adding public API’s that you are not using but can be used by hackers. So the other solution is to simple add the part you actual need to your solution. By adding the source file as linked resources, will enable you to share it between many projects and still maintain only one copy of the file.
Another good example of usage is if you for example are creating an application for both windows phone 7 and windows. In this case you need two separate projects for every class library.
In Visual Studio, choose ‘Add As link’ when adding an existing item.
Get all iteration paths in TFS programtically
A common way to organize work items in TFS is to assign them to different iterations. I’m using this with the scum model where every sprint corresponds to one iteration. So how can we get all iteration paths in TFS to use them in our own implementation. The information is not saved on the work items, we will need to look directly at the project object and recursively iterate on the iteration object tree to get all iteration paths.
Example project
In this example you will be able to connect to a TFS server and get all work items based on project and iteration path listed.
Read more
Free options for Reflector (.NET decompiler)
After Reflector did change their licensing so it was no longer free to use I did stick around for a long time on an old version of Reflector. The time have now come to find an replacement for Reflector. After some searching I found 4 good candidates.
JustDecompile
http://www.telerik.com/products/decompiling.aspx
Feature
• Fast code navigation
• Create visual studio projects
• Extract resources from assemblies
• Easy assembly management
• Visual studio inline decompilation
• Command line support
• Integrate with Windows Explorer Context Menu
• Silverlight XAP decompilation from URL
Read more
Scrumy Beta v1.0.7 is released
The big change in this release is an improved UI for changing the layout of the printed items.
The release can be download here: http://scrumy.codeplex.com/releases/view/100750
Moving to Dynamics CRM
After a bit more than 6 years the time have arrived to move away from Dynamics NAV. So from this week I have moved to product team Dynamics CRM. I may still write some more blogs about Dynamics NAV but don’t expect many more of them. I’m looking forward to this new challenges and I hop soon to start blogging about Dynamics CRM and my new projects.
Open sourced some of my projects
I recently decided to open soruce some of my projects. You can find them under Projects on the blog.
DiveBuddy Planner
http://divebuddyplanner.codeplex.com
Is decompression planning application for windows phone 7. The algorithm used is based on Buhlmann ZHL16A, ZHL16B and ZH 17B with m-value gradient conservatism. Both air, nitrox and trimix diving is supported.
Scrumy
https://scrumy.codeplex.com
Scrumy is Visual Studio plugin. The current functionality cover printing TFS item to be used on a scrum progress board or kanban board.