MSTestExe
|
VSTest.Console.exe
|
Comments
|
C:\Program Files (x86)\Microsoft Visual Studio 14\Common7\IDE\MSTest.exe
|
C:\Program Files (x86)\Microsoft Visual Studio 14\Common7\IDE\CommonExtensions\Microsoft\ TestWindow\VSTest.Console.exe
|
Full Path for typical installation
|
mstest /testcontainer:tests.dll
|
Vstest.console.exe myTestFile.dll myOtherTestFile.dll
|
Pass test.dll
|
/resultsfile:testResults.trx
|
/Logger:trx
|
No direct way to specify test results file, see http://stackoverflow.com/questions/14483837/specifying-results-filename-for-vstest-console-exe
TestResults\UserName_MachineName 2016-04-07 18_12_02.trx
|
/category:!Broken
|
/TestCaseFilter:”TestCategory!=Broken”
|
|
/testsettings:Local.TestSettings
|
/Settings:[file name] e.g.
/Settings:Local.RunSettings
|
|
mstest /testcontainer: “C:\TestProject2\myTestFile.dll” /testsettings:Local.TestSettings /category:!Broken /resultsfile:testResults.trx
|
vstest.console.exe “C:\TestProject2\myTestFile.dll“ /Settings:Local.RunSettings /TestCaseFilter:”TestCategory=!Broken” /Logger:trx
|
Full example
|
Tests.runsettings
<!– MSTest adapter –> <MSTest> <MapInconclusiveToFailed>True </MapInconclusiveToFailed> <CaptureTraceOutput>false</CaptureTraceOutput> <DeleteDeploymentDirectoryAfterTestRunIsComplete> False </DeleteDeploymentDirectoryAfterTestRunIsComplete> <DeploymentEnabled>False</DeploymentEnabled> </MSTest> </RunSettings> |
RunSettings for vstest.console adapter
|
Configure unit tests by using a .runsettings file https://msdn.microsoft.com/en-us/library/jj635153.aspx
|
/test:[test name]
to run multiple tests, use the /test option multiple times.
TestClass matches if the name Contains pattern
|
/Tests:[test name]
To provide multiple values, separate them by commas. Example: /Tests:TestMethod1,testMethod2
Classes and Methods matches if the name contains pattern
|
|
Monthly Archives: April 2016
AutoPropertiesToString helper method
I needed in ToString() method for a class to log auto-properties. Below are two methods that I used
/// <summary>
///
/// </summary>
/// <param name=”obj”></param>
/// <param name=”declaredOnly”></param>
/// <returns></returns>
/// <remarks> Created to log DeclaredOnly in the current class using GetType().GetProperties(), for full object dump other methods may be more appropriate
/// See http://stackoverflow.com/questions/4023462/how-do-i-automatically-display-all-properties-of-a-class-and-their-values-in-a-s
/// and http://stackoverflow.com/questions/852181/c-printing-all-properties-of-an-object?lq=1
/// </remarks>
public static string AutoPropertiesToString( object obj, bool printNulls=false, bool declaredOnly=true)
{
BindingFlags flags = BindingFlags .Public | BindingFlags.Instance;
if (declaredOnly) flags |= BindingFlags.DeclaredOnly;
var propertyInfos = obj.GetType().GetProperties(flags);
var sb = new StringBuilder();
foreach ( var info in propertyInfos)
{
if (info.IsAutoProperty())
{
var val = info.GetValue(obj, null);
if (printNulls == false && val == null)
continue;
var value = val ?? “(null)”;
sb.AppendLine(info.Name + “: ” + value);
}
}
return sb.ToString();
}
/// <summary>
/// It’s not fool proof, quite brittle
/// </summary>
/// <param name=”info”></param>
/// <returns></returns>
/// <remarks> from http://stackoverflow.com/questions/2210309/how-to-find-out-if-a-property-is-an-auto-implemented-property-with-reflection </remarks>
public static bool IsAutoProperty( this PropertyInfo info)
{
bool mightBe = info.GetGetMethod().GetCustomAttributes(typeof (CompilerGeneratedAttribute ),true ).Any();
if (!mightBe)
{
return false;
}
if (info.DeclaringType == null)
return false;
bool maybe = info.DeclaringType
.GetFields( BindingFlags.NonPublic | BindingFlags.Instance)
.Where(f => f.Name.Contains(info.Name))
.Where(f => f.Name.Contains( “BackingField”))
.Any(f => f.GetCustomAttributes(typeof (CompilerGeneratedAttribute ),true ).Any());
return maybe;
}
bad revision ‘rm’ error, when using git filter-branch –index-filter if called from batch file
I was trying to move a few directories from one repository to another and answer http://stackoverflow.com/a/17867910/52277 suggests to use
git filter-branch –index-filter ‘git rm –cached -qr –ignore-unmatch — . && git reset -q $GIT_COMMIT — apps/AAA libs/XXX’ –prune-empty — –all
I’ve put the command into batch file and got the error
> fatal: bad revision ‘rm’
The same error happened for an example from git documentation https://git-scm.com/docs/git-filter-branch
git filter-branch –index-filter ‘git rm –cached –ignore-unmatch — buildMaster.bat’ HEAD
However when I was running the command in git bash, it didn’t show any error and worked successfully.
It was acceptable for me. But I am still curious why including inside .bat cause an error with unclear message
Windows Feedback application in Windows 10 is very immature.
Recently I wanted to submit feedback to mIcrosoft and had to use Windows Feedback application in Windows 10. I was surprised how immature it is. They have Connect website https://connect.microsoft.com that working fine for many applications, including visual studio and SQL server. They also using Uservoice sites, that also have acceptable user interface( apart of stupid limit for number of votes). What was the reason to create new proprietary application, supported only by Windows 10.
Link in MS Feedback is generated as something like
Windows-Feedback:?contextid=79&feedbackid=b11f8bdf-eaf4-4799-8e65-5161924ad22c&form=1&src=2
As you can expect, browsers do not understand these links. Even when I copied the link into feedback search field, it didn’t find it.
When I upvoted existing feedback, I’ve added a comment. However, when I open the same feedback again, my comments were not visible. They should show the all discussion, not only initial suggestion.
I am not able to copy text of existing feedback. I opened it but text is not selectable. I tried to share via mail, but the feedback is added as image, not as text.
It will be much better if MS will create Web client for feedback database to be viewed in normal browser.
Powershell script that requires administrative privileges.
#from http://serverfault.com/a/12306/107224function Run-Elevated ($scriptblock ){# TODO: make -NoExit a parameter# TODO: just open PS (no -Command parameter) if $scriptblock -eq ”$sh = new-object -com ‘Shell.Application’$sh. ShellExecute(‘powershell’, “-NoExit -Command $scriptblock “, ”, ‘runas’)}Run-Elevated “cd $PSScriptRoot; ActualScript.ps1 ; Read-Host -Prompt `”Press_Enter_to_continue`” ”
Global Convertion from MStest Assert to FluentAssertions
How I moved my blog from GeeksWithBlogs to WordPress.
NSubstitute Received should apply to the class, not to the method
LocationHelper.CountryName(“AU”).Received(1);//incorrectCompiler was happy about this, but when running the test, I’ve got an exception
{NSubstitute.Exceptions.NotASubstituteException: NSubstitute extension methods like .Received() can only be called on objects created using Substitute.For<T>() and related methods.
at NSubstitute.Core.CallRouterResolver.ResolveFor(Object substitute)
Substitute.ForPartsOf<T>
records all calls made to virtual members, so we can check Received()
calls made to any partial substitute.I moved my blog from GeeksWithBlogs
This is my first post at WordPress. I had a http://geekswithblogs.net/mnf/ blog at GeeksWithBlogs for 10 years. But recently I had a big concern, that GeeksWithBlogs site is not supported at all. The support does not reply to emails, Twitter messages and reports on the support forum. I will not be surprised, if the GWB site will suddenly shutdown without any warning.
I did a research to find a blogging platform, and WordPress was recommended in most places. It was a big work to migrate the blog, because there is no out of the box tools ( The code that I was using is located on https://github.com/MNF/gwb-to-wordpress ).
Now I am thinking how can I achieve the traffic and search engine ranking, that I had in GeeksWithBlogs.