Reading NCover settings from a file

Reading NCover settings from a file

I have a C# application launching a batch file run.tests.bat with some parameters like this:

"C:\Program Files\NCover\NCover.Console.exe" "C:\Program Files\NUnit 2.5.6\bin\net-2.0\nunit-console.exe" "D:\LatestUnitTestBinaries\NightlyTrunk\Exchange connectors.nunit" //a "MyComp.Eurex.12;MyComp.Eurex.13;MyComp.ExchangeConnector.DGCXOrderConnector" //x "D:\LatestUnitTestBinaries\NightlyTrunk\Exchange connectors.nunit.Coverage.xml" //l "D:\LatestUnitTestBinaries\NightlyTrunk\Exchange connectors.nunit.log" //ea "MyComp.NG.Serialization.GeneratedSerializatorAttribute;MyComp.SDS.DbEngine.IFaces.GeneratedForSDSPluginAttribute;MyComp.TranslatorGen.GeneratedTranslatorAttribute" //ef "^((?!.D:\NGBuilds).)$" //ll Normal

Problem is the ProcessStartInfo.Arguments are limited to 2080 chars and therefore when I have more than this (some tests contain a large list of assemblies) I get an "Access denied" error.

In order to avoid such a problem I thought about writing all these parameters into a file and then the batch file will have just one parameter -name of this file (using //cr option ): "C:\Program Files\NCover\NCover.Console.exe" //cr "D:\LatestUnitTestBinaries\NightlyTrunk\Exchange connectors.nunit.arg.txt" "C:\Program Files\NUnit 2.5.6\bin\net-2.0\nunit-console.exe"

But then I get this error: Unrecognized serialization format for ICoverageConfig config: NotSupported Expected: NCoverSettings

So it seems this file storing the settings must have a special format -it is not ok that I wrote into it the parameters for NcoverConsole like this:

"D:\LatestUnitTestBinaries\NightlyTrunk\Exchange connectors.nunit" //a "MyComp.Eurex.12;MyComp.Eurex.13;MyComp.ExchangeConnector.DGCXOrderConnector" //x "D:\LatestUnitTestBinaries\NightlyTrunk\Exchange connectors.nunit.Coverage.xml" //l "D:\LatestUnitTestBinaries\NightlyTrunk\Exchange connectors.nunit.log" //ea "MyComp.NG.Serialization.GeneratedSerializatorAttribute;MyComp.SDS.DbEngine.IFaces.GeneratedForSDSPluginAttribute;MyComp.TranslatorGen.GeneratedTranslatorAttribute" //ef "^((?!.D:\NGBuilds).)$" //ll Normal

If i will try first to create the settings file with //cs option -I will have some error when parameters are longer than 2080 chars.

My question is -how can I avoid the problems with longer parameters ? How can I launch NCover console from a C# application when the parameters string is longer than 2080 chars? Thanks


RE: Reading NCover settings from a file

krc_pg,

Great question! I'd recommend you use the Script Helper in NCover Explorer to get you going on the settings file. Enter all your settings for coverage using the NCover Project Actions > Project Options GUI. Once you're done, go to Script Helper > NCover Settings File. You will see a basic XML stubbed out for you. Copy / Paste / (Edit) that file and save it. Use the //cr option (http://docs.ncover.com/ref/3-0/ncover-console/command-line/program-settings#cs) to load it. That should do the trick. If not, let me know at support@ncover.com.