Metadata in Tests

Anton Arhipov

Ever since TeamCity 2018.2, a test run in TeamCity can be associated with some supplementary information (metadata), in addition to a test’s status, execution time, and output. This information can be used to provide things like extra logs, screenshots, numeric values, and tags.

You can now use service messages to report this kind of additional test data in TeamCity and then view it using the TeamCity Web UI. Consult the corresponding documentation for details.

On GitHub, you can find a sample project that demonstrates the use of metadata with tests. In TeamCity, create a project from the URL using this GitHub repository, and then run the build. Once the build completes, on the Tests tab, next to the test name, you will notice a paperclip icon indicating that the test results include additional metadata.

TeamCity-test-medatada

By clicking the icon, you will open a popup displaying the attached metadata. The same information is presented on the build overview screen. Notice that a numeric value renders a 2D-graph from the historical results.

TeamCity-test-metadata-overview

In the demo project, see CodeTest.kt for the examples of the metadata reporting code.

Comments below can no longer be edited.

5 Responses to Metadata in Tests

  1. Oleg Shevchenko says:

    January 15, 2019

    Great feature, but I can’t make it work.
    Could you please create a demo project for C#?

  2. Kirill Maximov says:

    January 15, 2019

    Hello Oleg,

    Unfortunately, we don’t have such a project at hand. To diagnose the issue, take a look at the build log warnings, TeamCity should warn you if it notices incorrectly formed service messages. Most likely issue is a wrong reporting of a test name in the service message if you report metadata after the test end.

    Hope this helps,

  3. Darren Collins says:

    February 14, 2019

    Hah, was looking for a “staple icon” in the image and couldn’t see it, thought I was going crazy, and then realised you were talking about the paperclip icon :-).

    • Anton Arhipov says:

      February 14, 2019

      Let me fix that 😉

      • Darren Collins says:

        February 14, 2019

        Hehe, gave me a morning laugh!

        That aside, I really like this feature. It’s a neat way to flag some extra info to investigate intermittent failures etc. Thanks!

Subscribe

Subscribe for updates