.NET library to deal with TeamCity Service messages
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

Service Messages .NET library for

NuGet TeamCity.Dotnet.Integration License

This library provides read/write access to TeamCity Service messages. Take a look at the description of service messages at this page.

Usage:

Most use cases are covered in tests.

To create service message, use:

JetBrains.TeamCity.ServiceMessages.Write.ServiceMessageFormatter.FormatMessage

To parse service messages, use:

JetBrains.TeamCity.ServiceMessages.Read.ServiceMessageParser.ParseServiceMessages

There is an API to generate TeamCity specific service messages, use:

JetBrains.TeamCity.ServiceMessages.Write.Special.ITeamCityWriter

to get the instance of the object create an instance of the factory and get it by:

new JetBrains.TeamCity.ServiceMessages.Write.Special.TeamCityServiceMessages().CreateWriter()

for example:

using (var writer = new TeamCityServiceMessages().CreateWriter(str => Console.WriteLine(str))
using (var block = writer.OpenBlock("Tests"))
using (var testClass = block.OpenTestSuite("TestClass"))
{
    using (var test = testClass.OpenTest("Test1"))
    {
        test.WriteStdOutput("Some output");
        test.WriteDuration(TimeSpan.FromSeconds(1));
    }

    using (var test = testClass.OpenTest("Test2"))
    {
        test.WriteIgnored();
    }
}

License:

Apache 2.0.