How to implement parallel execution using Specrun for NUnit - nunit

I have installed the following NuGets : Specflow.Nunit,specflow ,Specrun.Nunit along with NUnit 2.6.3.
I am trying to execute runtests.cmd(automatically generated by specrun.nunit) but I am getting the following error :
TechTalk.SpecRun.Framework.SpecRunException: At least one test thread aborted. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'Void TechTalk.SpecRun.SpecRunner.Initialize()'.
My default.srprofile contains :
<?xml version="1.0" encoding="utf-8"?>
<TestProfile xmlns="http://www.specrun.com/schemas/2011/09/TestProfile">
<Settings projectName="<PROJECTNAME>" projectId="{------}" />
<Execution stopAfterFailures="3" testThreadCount="2" testSchedulingMode="Sequential" />
<!-- For collecting by a SpecRun server update and enable the following element. For using the
collected statistics, set testSchedulingMode="Adaptive" attribute on the <Execution> element.
<Server serverUrl="http://specrunserver:6365" publishResults="true" />
-->
<TestAssemblyPaths>
<TestAssemblyPath>projectname.dll</TestAssemblyPath>
</TestAssemblyPaths>
<DeploymentTransformation>
<Steps>`enter code here`
<!-- sample config transform to change the connection string-->
<!--<ConfigFileTransformation configFile="App.config">
<Transformation>
<![CDATA[<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="MyDatabase" connectionString="Data Source=.;Initial Catalog=MyDatabaseForTesting;Integrated Security=True"
xdt:Locator="Match(name)" xdt:Transform="SetAttributes(connectionString)" />
</connectionStrings>
</configuration>
]]>
</Transformation>
</ConfigFileTransformation>-->
</Steps>
</DeploymentTransformation>
</TestProfile>
Also on the VS Output window I am getting this error :
Could not load file or assembly 'TechTalk.SpecRun, Version=1.3.0.76, Culture=neutral, PublicKeyToken=d0fc5cc18b3b389b' or one of its dependencies. The system cannot find the file specified.
Can someone please help me with this ?

You would to change this strings:
<RelocateConfigurationFile target="CustomConfig.{TestThreadId}.config" />
<ConfigFileTransformation configFile="App.config">
Full answer:
https://github.com/techtalk/SpecFlow/issues/954

Related

Setup NuGet.Config with TFS package source for a docker build

With the following NuGet.Config file, I'm getting this error message during a docker container build:
What's the correct way to setup NuGet.Config?
/usr/share/dotnet/sdk/2.1.104/NuGet.targets(104,5): error : Unable to load the service index for source https://mycompany.pkgs.visualstudio.com/_packaging/myfeed/nuget/v3/index.json. [/src/Grains.sln]
/usr/share/dotnet/sdk/2.1.104/NuGet.targets(104,5): error : Response status code does not indicate success: 401 (Unauthorized). [/src/Grains.sln]
I have not setup the authorization for the private nuget feed correctly.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
<add key="MyCompany" value="https://mycompany.pkgs.visualstudio.com/_packaging/myfeed/nuget/v3/" />
</packageSources>
<!-- Used to store credentials -->
<packageSourceCredentials />
<apikeys>
<add key="https://mycompany.pkgs.visualstudio.com/_packaging/myfeed/nuget/v3/index.json" value="mytoken" />
</apikeys>
</configuration>
I got it working with this format:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="MyFeed" value="https://mycompany.pkgs.visualstudio.com/_packaging/myfeed/nuget/v3/index.json" />
</packageSources>
<packageSourceCredentials>
<MyFeed>
<add key="Username" value="myemailid" />
<add key="ClearTextPassword" value="mytoken" />
</MyFeed>
</packageSourceCredentials>
</configuration>

Failed to publish application to Azure Service Fabric cluster

I am trying to publish an application to Azure Service Fabric cluster. The moment I click publish from VS2015, I get those following errors:
"An error occurred reading the file xxx\publishprofiles\cloud.xml. There is an error in XML document (7, 6)"
"Object reference not set to an instance of an object"
This is the content of the Cloud.xml file:
<?xml version="1.0" encoding="utf-8"?>
<PublishProfile xmlns="http://schemas.microsoft.com/2015/05/fabrictools">
<ClusterConnectionParameters ConnectionEndpoint=... />
<ApplicationParameterFile Path="xxx\ApplicationParameters\Cloud.xml" />
<UpgradeDeployment Mode="Monitored" Enabled="true">
<Parameters FailureAction="Rollback" Force="True" />
<Parameters UpgradeReplicaSetCheckTimeoutSec="1" Force="True" />
</UpgradeDeployment>
</PublishProfile>
It seems that I can have only one of the parameters (FailureAction OR UpgradeReplicaSetCheckTimeoutSec) for VS2015 to successfully load the file.
I wonder if anyone has some insights into this issue?
There can only be one Parameters element. Combine all your parameters into just one Parameters element.
Example:
<?xml version="1.0" encoding="utf-8"?>
<PublishProfile xmlns="http://schemas.microsoft.com/2015/05/fabrictools">
<ClusterConnectionParameters ConnectionEndpoint=... />
<ApplicationParameterFile Path="xxx\ApplicationParameters\Cloud.xml" />
<UpgradeDeployment Mode="Monitored" Enabled="true">
<Parameters FailureAction="Rollback" Force="True" UpgradeReplicaSetCheckTimeoutSec="1" />
</UpgradeDeployment>
</PublishProfile>

How do you enable logging for CrmServiceClient in the Xrm Tooling toolkit?

I'm having issues trying to log in to a CRM Online organization through the use of the latest version of the Xrm Tooling nuget package using the connection string constructor from a custom powershell cmdlet.
I'm receiving a rather unhelpful "Unable to Login to Dynamics CRM" error message and am attempting to enable tracing to troubleshoot but have not been able to enable it by modifying the .dll.config file like the below (taken from an XrmToolbox issue on GitHub):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<trace autoflush="true" />
<sources>
<source name="Microsoft.Xrm.Tooling.Connector.CrmServiceClient"
switchName="Microsoft.Xrm.Tooling.Connector.CrmServiceClient"
switchType="System.Diagnostics.SourceSwitch">
<listeners>
<add name="console" type="System.Diagnostics.DefaultTraceListener" />
<remove name="Default" />
<add name ="fileListener" />
</listeners>
</source>
<source name="Microsoft.Xrm.Tooling.CrmConnectControl"
switchName="Microsoft.Xrm.Tooling.CrmConnectControl"
switchType="System.Diagnostics.SourceSwitch">
<listeners>
<add name="console" type="System.Diagnostics.DefaultTraceListener" />
<remove name="Default" />
<add name ="fileListener" />
</listeners>
</source>
</sources>
<switches>
<!--
Possible values for switches: Off, Error, Warning, Info, Verbose
Verbose: includes Error, Warning, Info, Trace levels
Info: includes Error, Warning, Info levels
Warning: includes Error, Warning levels
Error: includes Error level
-->
<add name="Microsoft.Xrm.Tooling.Connector.CrmServiceClient" value="Verbose" />
<add name="Microsoft.Xrm.Tooling.CrmConnectControl" value="Verbose" />
<add name="Microsoft.Xrm.Tooling.WebResourceUtility" value="Verbose" />
</switches>
<sharedListeners>
<add name="fileListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="XRMToolingLogs.log" />
<!--<add name="eventLogListener" type="System.Diagnostics.EventLogTraceListener" initializeData="XRMTooling" />-->
</sharedListeners>
</system.diagnostics>
</configuration>
I was able to work around this by configuring the listener programmatically through:
Microsoft.Xrm.Tooling.Connector.TraceControlSettings.TraceLevel = System.Diagnostics.SourceLevels.All;
Microsoft.Xrm.Tooling.Connector.TraceControlSettings.AddTraceListener(new TextWriterTraceListener("log.txt"));
Which pointed me to the actual error which was that the CrmServiceClient was expecting a URL with the organization unique name instead of the URL name.

Web.Debug.Config with different connection strrings

I have a Web.config file and a Web.Debug.Config file. My Web.Debug.Config file is practically empty and I would like to add to it a connectionstrings section to override the one in the Web.Config file. I tried just adding the connectionstrings section in the config file but it didn't pick it up. I know there are some commands I need to use in one or both config files but am not sure what they are. Can someone help me out please?
Thanks,
Sachin
You should be able to do the following (not tested, but should work) to replace the Web.Config file's connectionStrings section:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings xdt:Transform="Replace">
<add name="AuthenticationDatabase" connectionString="connection-string-here" providerName="System.Data.SqlClient" />
<add name="OtherDatabase" connectionString="connection-string-here" providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
If you're just looking to update an existing connectionString:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add xdt:Transform="SetAttributes" xdt:Locator="Match(name)" name="AuthenticationDatabase" connectionString="new-string-here" providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>

Web config transform on microsoft.identityModel - 'http://schemas.microsoft.com/XML-Document-Transform' attribute is not declared

I have got a Web.Release.config that is successfully transforming a connection string.
When I add a microsoft.identityModel section I get a warning saying
The 'http://schemas.microsoft.com/XML-Document-Transform' attribute is
not declared
And the transform doesnt work on that section.
What am I missing to get the transform to work?
Complete Web.Release.config here
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="MYNAME"
connectionString="metadata=res://*/Models.MYCOMPANY-Sales-Demo.csdl|res://*/Models.MYCOMPANY-Sales-Demo.ssdl|res://*/Models.MYCOMPANY-Sales-Demo.msl;provider=System.Data.SqlClient;provider connection string="data source=.;initial catalog=MYCOMPANYDemo;UID=MYCOMPANYDBUser;Password=********;multipleactiveresultsets=True;App=EntityFramework""
xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />
</connectionStrings>
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
<microsoft.identityModel>
<service>
<audienceUris>
<add value="http://MYCOMPANY-sales-demo.cloudapp.net/" xdt:Transform="Replace"/>
</audienceUris>
<federatedAuthentication>
<wsFederation realm="http://MYCOMPANY-sales-demo.cloudapp.net/" xdt:Transform="SetAttributes(realm)" />
</federatedAuthentication>
</service>
</microsoft.identityModel>
</configuration>
I've run into this also but have gotten it to work. What I did was a "RemoveAll" and an "Insert" instead of a replace/match:
<audienceUris>
<add xdt:Transform="RemoveAll" />
<add value="http://example.com/" xdt:Transform="Insert" />
</audienceUris>
When I do it that way I get the desired transform and output config file.
This appears to be working now with Visual Studio 2012 (v4.5.50709). I still get the 'attribute is not declared' warning in the editor, but the xdt:Transform="Replace" directive is working for me.