Sunday, June 26, 2011

Ncover Installation in windows server 2008

Recently I was trying to install Ncover in Windows Server 2008. Even though I had installed .Net framework 4.0 Ncover setup threw an error saying that "you need to have .Net 3.5 or above to install NCover".I had re installed .Net Framework 4.0 several times ad restarted the server but no effect.
Then I went to the server manger panel and I saw a section called feature summery. In add features section you can add .Net framework 3.5 features. After a restart everything worked fine.

Tuesday, June 21, 2011

Ncover Command Line For MSTest

If you are using MSTest here is the command windows batch command to generate test results

"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\mstest.exe" /testcontainer: \yourTestProjectPath\YourTests.dll /testcontainer: \yourTestProjectPath2\YourTests2.dll /resultsfile:results.trx /testsettings:YourTestSettingsPath \local.testsettings

You can add several test projects using /testcontainer: argument. Here I have used two test projects. To use NCover we need to change this command by adding NCover commands . NCover arguments are started with “//” and for MSTest they started with “/”. Here Is the Ncover command to generate coverage.nccov and coverage.trend files.

"C:\Program files (x86)\NCover\NCover.Console.exe" "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\mstest.exe" //x mstest_coverage.nccov //at "coverage.trend" /testcontainer: \yourTestProjectPath\YourTests.dll /testcontainer: \yourTestProjectPath2\YourTests2.dll /resultsfile:results.trx /testsettings:YourTestSettingsPath \local.testsettings

There are more options with NCover you can find those here Ncover command line

Now we have coverage.nccov and coverage.trend files we need to generate a HTML report from these two. For that we can use Ncover Reportng tool. Here is the Command to generate NCover HTML reports.

ncover.reporting mstest_coverage.nccov //lt coverage.trend //or FullCoverageReport:Html:output

Here we are generating full Coverage report in the directory called output

Tuesday, December 14, 2010

Sort UL element by the customized sorting funtion by JQuery

We can customize javascript sort() function for any requirement as given below. In this example
it sorts the List items according to text of the fist child.

function SortList() {

var listToSort = $('#tabmenu');
var listitems = listToSort.children('li').get();
listitems.sort(function (a, b) {
var contentA = $(a).first().text().toUpperCase();
var contentB = $(b).first().text().toUpperCase();
return (contentA != contentB) ? 1 : 0;
$.each(listitems, function (idx, itm) { listToSort.append(itm); });

You can customize this functionality as you want by changing these two lines of code

var contentA = $(a).first().text().toUpperCase();
var contentB = $(b).first().text().toUpperCase();
As an example,
If you want to sort list items according to the id of the first element you can change like this

var contentA = $(a).first().attr('id').toUpperCase();
var contentB = $(b).first().attr('id').toUpperCase();