Friday, March 18, 2016

Build Script Interaction with TeamCity - Reporting Tests


Reporting Tests to TeamCity

To use the TeamCity on-the-fly test reporting, a testing framework needs dedicated support for this feature to work (alternatively, XML Report Processing can be used).
If TeamCity doesn't support your testing framework natively, it is possible to modify your build script to report test runs to the TeamCity server using service messages. This makes it possible to display test results in real-time, make test information available on the Tests tab of the Build Results page.

Supported test service messages

Test suite messages:
Test suites are used to group tests. TeamCity displays tests grouped by suites on Tests tab of the Build Results page and in other places.
##teamcity[testSuiteStarted name='suiteName']
<individual test messages go here>
##teamcity[testSuiteFinished name='suiteName']
All the individual test messages are to appear between testSuiteStarted and testSuiteFinished (in that order) with the same name attributes.
Suites may also be nested.
Test start/stop messages:
##teamcity[testStarted name='testName' captureStandardOutput='<true/false>']
<here go all the test service messages with the same name>
##teamcity[testFinished name='testName' duration='<test_duration_in_milliseconds>']
Indicates that the test "testName" was run. If the testFailed message is not present, the test is regarded successful.
duration (optional numeric attribute) - sets the test duration in milliseconds (should be an integer) to be reported in TeamCity UI. If omitted, the test duration will be calculated from the messages timestamps. If the timestamps are missing, from the actual time the messages were received on the server.
captureStandardOutput (optional boolean attribute) - if true, all the standard output (and standard error) messages received between testStarted and testFinished messages will be considered test output. The default value is false and assumes usage of testStdOut and testStdErr service messages to report the test output.
Icon
  • All the other test messages (except for testIgnored) with the same name attribute should appear between the testStarted and testFinished messages (in that order).
  • Currently, the test-related service messages cannot be output with Ant's echo task until flowId attribute is specified.
It is highly recommended to ensure that the pair of test suite + test name is unique within the build.
For advanced TeamCity test-related features to work, test names should not deviate from one build to another (a single test must be reported under the same name in every build). Include absolute paths in the reported test names is strongly discouraged.
Ignored tests:
##teamcity[testIgnored name='testName' message='ignore comment']
Indicates that the test "testName" is present but was not run (was ignored) by the testing framework.
As an exception, the testIgnored message can be reported without the matching testStarted and testFinished messages.
Test output:
##teamcity[testStarted name='className.testName']
##teamcity[testStdOut name='className.testName' out='text']
##teamcity[testStdErr name='className.testName' out='error text']
##teamcity[testFinished name='className.testName' duration='50']
The testStdOut and testStdOrr service messages report the test's standard and error output to be displayed in the TeamCity UI. There must be only one testStdOut and one testStdErr message per test.
An alternative but a less reliable approach is to use the captureStandardOutput attribute of the testStarted message.
Test result:
##teamcity[testStarted name='MyTest.test1']
##teamcity[testFailed name='MyTest.test1' message='failure message' details='message and stack trace']
##teamcity[testFinished name='MyTest.test1']
 
##teamcity[testStarted name='MyTest.test2']
##teamcity[testFailed type='comparisonFailure' name='MyTest.test2' message='failure message' details='message and stack trace' expected='expected value' actual='actual value']
##teamcity[testFinished name='MyTest.test2']
Indicates that the "testname" test failed. Only one testFailed message can appear for a given test name.
message contains the textual representation of the error.
details contains detailed information on the test failure, typically a message and an exception stacktrace.
actual and expected attributes can only be used together with type='comparisonFailure to report comparison failure. The values will be used when opening the test in the IDE.

Here is a longer example of test reporting with service messages:
##teamcity[testSuiteStarted name='suiteName']
##teamcity[testSuiteStarted name='nestedSuiteName']
##teamcity[testStarted name='package_or_namespace.ClassName.TestName']
##teamcity[testFailed name='package_or_namespace.ClassName.TestName' message='The number should be 20000' details='junit.framework.AssertionFailedError: expected:<20000> but was:<10000>|n|r    at junit.framework.Assert.fail(Assert.java:47)|n|r    at junit.framework.Assert.failNotEquals(Assert.java:280)|n|r...']
##teamcity[testFinished name='package_or_namespace.ClassName.TestName']
##teamcity[testSuiteFinished name='nestedSuiteName']
##teamcity[testSuiteFinished name='suiteName']

Interpreting test names

The Tests tab of the Build Results page allows grouping by suites, packages/namespaces, classes, and tests. Usually the attribute values are provides as they are reported by your test framework and TeamCity is able to interpret which part of the reported names is the test name, class, package as follows:
  • TeamCity takes the suite name from the corresponding suite message
  • if the reported test name starts with the suite name, it is truncated
  • the part of the test name after the last dot is treated as a test name
  • the part of the test name before the last dot is treated as a class name
  • the rest of the test name is treated as a package/namespace name

Source: https://confluence.jetbrains.com/display/TCD8/Build+Script+Interaction+with+TeamCity

Monday, March 7, 2016

Creating self signed certificates with makecert.exe for development

Creating self signed certificates with makecert.exe for development


makecert.exe ^
-n "CN=CARoot" ^
-r ^
-pe ^
-a sha512 ^
-len 4096 ^
-cy authority ^
-sv CARoot.pvk ^
CARoot.cer

pvk2pfx.exe ^
-pvk CARoot.pvk ^
-spc CARoot.cer ^
-pfx CARoot.pfx ^
-po Test123



Source

Tuesday, February 23, 2016

Friday, February 19, 2016

What tools, frameworks, etc do you find essential for development?

Usually I choose depending on the project requirements. Here are the categories of tools/frameworks I find useful:

IDE/Editors:
  • WebStorm
  • Visual Studio
  • Visual Studio Code
  • ReSharper
  • Notepad++
  • LinqPad

Databases:
  • MSSQL
  • MongoDB
  • Entity Framework

Network:
  • Fiddler

Communication/Documentation/Sharing
  • Skype
  • Hangout
  • Slack
  • Google docs
  • Wiki
  • Dropbox

Static analysis
  • nDepend
  • FxCop

Code quality
  • ESLint
  • StyleCop

Code coverage
  • nCover

CI
  • Team City
  • Jenkins
  • Msbuild
  • gulp

QA/Testing
  • nUnit
  • moq
  • Autofac

API testing
  • Postman
  • SoapUI

Browsers:
  • Google chrome

Website performance:
  • YSlow
  • Google webmaster tools
  • JSPerf

Web prototyping
  • JSFiddle/JSBin/Plunkr

Web development:
  • WebAPI
  • ASP.NET MVC
  • Bootstrap
  • jQuery
  • AngularJS
  • Google Analytics

VCS:
  • Github
  • Svn + AnkhSVN
  • tfs

Node.js
  • Express
  • Socket.io
  • Q
  • Mocha
  • Npm
  • web-inspector

VM/Containters
  • VMWare
  • Virtual Box
  • HyperV
  • Docker

Cloud:
  • Azure
  • AWS
Password manager
  • Keepass
    • Keepass2Android



Thursday, February 18, 2016

Debugging Node.js using Node.js Tools for Visual Studio (NTVS)

Node.js Tools for Visual Studio (NTVS) include advanced debugging features for debugging Node.js applications, like advanced breakpoints, and remote debugging of Node.js processes running on any OS (Windows, Linux, MacOS), or hosted on Windows Azure.

https://github.com/Microsoft/nodejstools/wiki/Advanced-Debugging

Tuesday, February 16, 2016

Load testing web sockets with Node.js - Fine tuning TCP/IP on Windows

Load testing WebSockets with Node.js


I was doing a load testing for a socket.io server. After creating a small client in Node.js using socket.io-client I faced with a limit of about 16K connections trying to run it on Windows 7.

It turned out that by default, dynamic ports are allocated between ports 49152 and 65535 (for a total of 16384 ephemeral ports). Using netsh allows to set both the starting port and port range.


 netsh int ipv4 set dynamicportrange protocol=tcp start=1025 num=64511


After running the command I was able to run a Node.js cluster of 8 processes each establishing 5000 connections. That makes 40K connections in total.

I also found a good article about stress testing node.js application

Tuesday, July 14, 2015

RabbitMQ

http://spring.io/blog/2011/04/01/routing-topologies-for-performance-and-scalability-with-rabbitmq/

Windows Service Bus 1.1

Installing Windows Service Bus for Windows Server  

http://joe.blog.freemansoft.com/2013/02/installing-microsoft-message-bus-for.html

Service Bus for Windows 1.1

https://roysvork.wordpress.com/2014/06/14/developing-against-service-bus-for-windows-1-1/
https://msdn.microsoft.com/en-us/library/jj841075.aspx
https://pablocastilla.wordpress.com/2013/06/18/publisher-subscriber-with-windows-azure-service-bus-and-wcf/


Authentication and Authorization

https://msdn.microsoft.com/en-us/library/dn205161.aspx
https://msdn.microsoft.com/en-us/library/dn441400.aspx


AMQP on Service Bus 1.1


https://social.msdn.microsoft.com/Forums/en-US/88a343a0-310d-462d-b96c-c54f730b7746/amqp-on-service-bus-11-onpremise?forum=servbus


SDK

https://social.msdn.microsoft.com/Forums/azure/en-US/88fb5677-6824-43dc-a1f1-0126308c4045/service-bus-for-windows-server-sdk?forum=servbus

Monday, May 25, 2015

Inverting direction of mouse scroll wheel in Windows 7

There is a registry setting named FlipFlopWheel that does this! HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\HID\VID_???\VID_???\Device Parameters. There might be multiple mouse entries. The default value for FlipFlopWheel should already ready 0. Change into 1 to invert scrolling. Reboot or possibly replug in mouse for changes to take effect.
To get the VID_??? number you have two options:
  1. Go to the mouse control panel, click the Hardware tab, then click Properties.
    Now in the HID-compliant mouse Properties window click the Details tab and select the Device Instance Path property. The registry path is in there. You only have to unplug and plug back in my mouse for this to take effect.


Wednesday, May 14, 2014

TFS switch working copy to another branch

Problem

I assume that you already have a working copy of $/branch1.
Let's say it's checked out to local folder c:\inetpub.
And you want to remap this working copy to $/branch2 without re-downloading everything again.

Solution

  1. First you'll need to unmap existing branch.
  2. Map working copy folder to new branch.
  3. Apply remap recursively.

Run the following commands from command line:

tf workfold /unmap $/branch1
tf workfold /map $/branch2 c:\inetpub
tf get c:\inetpub /remap /version:T /recursive


You'll probably want to unshelve a shelveset from another TFS branch afterwards.