house9

random code and what not

MSTest output result to HTML

MSTest generates trx (xml) files which can be viewed in Visual Studio. But often you will be executing MSTest from the command line via your Continuous Integration (CI) server and you will want to view them in an html format outside Visual Studio.

trx2html to the rescue!

  • download the zip file here - http://trx2html.codeplex.com/
  • unzip and put the files somewhere
    • I choose C:\Program Files (x86)\trx2html
  • execute it from the command line 

# in YourTestProject\bin\Release
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\mstest.exe" /testcontainer:YourTestProject.dll /resultsfile:TestResult.trx

"C:\Program Files (x86)\trx2html\0.6\trx2html.exe" TestResult.trx
# outputs TestResult.trx.htm


Comments

House 9
Try running it from the directory that your trx file is in

> cd DIRECTORY_WIHT_TRX_FILE

> "D:\share\TRX2HTML_A\0.6\trx2html.exe" TRX_FILE_NAME
Atul Mhetre
Hi,

I am having problem in converting trx file into HTML file.

I navigate to trx2htm.exe in command prompt and used command as - D:\share\TRX2HTML_A\0.6>cd D:\share\TRX2HTML_A\0.6

D:\share\TRX2HTML_A\0.6>trx2html atul.mhetre_NTPC01395 2013-01-22 15_05_51.trx
trx2html.exe
Create HTML reports of VSTS TestRuns. (c)rido'08
version:0.6.0.2798

Usage: trx2html .trx

D:\share\TRX2HTML_A\0.6>

So I am getting output as -

trx2html.exe
Create HTML reports of VSTS TestRuns. (c)rido'08
version:0.6.0.2798

Usage: trx2html .trx

And no html file is generating. Please help.

Visual Studio Solution Items in a sub directory

Visual Studio Solutions have the “Add New Solution Folder” option.



I don’t know about you but this makes me think it is going to create a physical directory on the hard drive to emulate what is in the solution, but this is not the case.



The thing that really drives me crazy is if you try to add Test1.txt to the SubFolder it will throw an error because it is really trying to write to the root directory. I think solution folders are only really supposed to be used to organize Visual Studio projects.

In my case I want to have a set of files that are not really part of a Visual Studio project but I want them available in the solution. It turns out there is a Project type called “Empty Project”.


This is exactly what the doctor ordered!

You will probably want to do one additional step. Set this “Empty Project” to not build, otherwise you will get a compile time error. Right click on the Solution > Properties > Configuration Properties > Configuration, then un-check the “Build” for this project.

Found out about this from this stackoverflow post.

Here is a good link explaining what you would use a solution folder for, besides a ReadMe.txt

Ergonomic keyboard for the Mac

The keyboards that come with Macs look really nice, the quality seems pretty good, but I just cannot use a flat keyboard, after a few days my wrists and hands started complaining big time.

After some searching I came across the Kinesis Freestyle keyboard, they make one with Windows layout and another with Mac layout. They are not cheap, however I use a keyboard all day, every day so for me it is worth the money.

If you get the Freestyle you also need to get the Freestyle VIP - Keyboard accessories kit, otherwise you basically just have a flat keyboard again
The VIP accessory kit will give you 10 and 15 degree angles, they also have some other accessory kits that will give you up to 90 degree angle, I believe that kit is very expensive, the 15 degree works fine for me, but the Ascent kit looks interesting.

Eight inches of cable between each side of the keyboard, put them where you want

pivot point if you want them close and asymmetrical

10 degree

15 degree



CQRS with .NET and C#

I’ve been intrigued with the idea of CQRS for some time; ever since I watched an infoQ presentation by Greg Young on the subject. What is CQRS?
Command-Query Responsibility Segregation
See the links below to for more information from the experts.

Over the last month I’ve actually had the opportunity to work with CQRS, so far I am really enjoying it. Separating your reads from your writes is truly liberating! Listed below are a bunch of resources related to CQRS:

Informational:

OSHA Safety Software

I’ve been working on this project off and on for quite sometime. If you are a small to mid size business in California and you need Safety Documents and Safety Management Software check out www.safetysanity.com.

Use this code to save $100 off the setup fees
2011-SAVE-100
We’ve simplified the process of creating a Safety Program; starting with Safety Document creation through managing Employee Training, Equipment Inspections and Accident Reporting.
www.safetysanity.com
Our software application  generates a Safety Program which is compliant with Cal/OSHA regulations. Every business in California is required by law to not only have a Safety Program, but also prove that they are following their program. Safety Sanity makes it easy! Learn more at www.safetysanity.com.

ASP MVC Razor templates with nested layout and sections

Using ASP MVC 3 with Razor views.

Ran into an issue with nested layouts and wanting to render a section in a top level layout, but define it in the view which uses a ‘child’ layout (master) page. This was generating a runtime error of:

The following sections have been defined but have not been rendered for the layout page… 

I posted some code to the asp.net forum and github. A nice workaround was supplied by ‘Imran Baloch’


Comments

billy.braga
I had the same problem. Seems when you have three levels of layouts, the intermediate one must render all sections of the child, even if the top most parent will do so.

Automapper Datatable to List

I did a few Google searches for ”c# automapper datatable to list” but nothing good showed up right away, maybe this post will help someone in the future?

The solution showed up on stackoverflow here is the link

http://stackoverflow.com/questions/2429194/automapper-mapping-ienumerable-to-datareader-issue

and here is a code snippet



Note that we are actually mapping IDataReader to a list, and DataTable has convenience method to do that for us ‘CreateDataReader’


Comments

happyapostate
Thanks House9. I've added an extension method to DataTable using your code, and it works fine. Now I just call ToList with the appropriate type for the records and away we go.

Get the date of the beginning and end of a month using Ruby

Sometimes Ruby blows my mind, I needed to get the start date and end date of the previous month. Guess what Ruby just happens to have methods to handle this - beginning_of_month, end_of_month, there is even beginning_of_quarter and end_of_quarter if you need them!