Skip to content

Conversation

@timo-reymann
Copy link
Contributor

@timo-reymann timo-reymann commented Feb 9, 2025

This adds support for adding custom properties to the junit testcase element, based on the framework, requested in #153

This supports:

  • NUnit.Category
  • XUnit.Trait (either directly attached to a method or discovered via XUnit.TraitDiscoverer)
  • Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.TestProperty

Changes

Brief overview of the changes to areas of the project

GitHub actions

  • Force color output for dotnet - that makes it easier to detect and read error messages in action logs
  • Set up nuget cache using cache action (please note that with v4 this is natively integrated, I did not manage to set up v4 without too much fiddling with existing config)

If you are open for upgrading to v4 of the dotnet action I can also give it a spin, in a dedicated PR, please just let me know

Logger

  • Extends junit xml serializer

Testing

  • Created a new test (assets) project JUnit.Xml.TestLogger.XUnit.NetCore.Tests to verify the xUnit discoverer, also combined with traits works
  • Create new test suite JUnitTestLoggerXUnitAcceptanceTests to run the added xUnit project
  • Extended Junit.xsd schema & changes the inline format for changes to the file to make it easier to track down

Not entirely sure if thats the appropiate way to do for this repository, this way logic can be tested easily with xUnit

@codito
Copy link
Contributor

codito commented Feb 11, 2025

@timo-reymann thank you. Changes are looking great.

I'm curious about the *TestAdapter.cs changes. Apart from the NUnit, the other frameworks should already populate resultInfo.Traits. Are there cases where Traits are not correctly filled by the frameworks?

Edit: after reading the changes once more, I believe this might be required for the Trait discoverer scenario.

uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're not using NuGet lock files, should we use Directory.Packages.props for hash key?

@codito
Copy link
Contributor

codito commented Feb 11, 2025

If you are open for upgrading to v4 of the dotnet action I can also give it a spin, in a dedicated PR, please just let me know

Yes, we can do this separately. Since we'll change this eventually, we can ignore the cache file hash related comment above.

Created a new test (assets) project JUnit.Xml.TestLogger.XUnit.NetCore.Tests to verify the xUnit discoverer, also combined with traits works

This is good as well.

Let's merge this one 🚀

@codito codito merged commit f555322 into spekt:master Feb 11, 2025
3 checks passed
@timo-reymann
Copy link
Contributor Author

I checked again with the v4 action and it probably will never work as the running .NET sdk will be always the current LTS; which does not work for some reason with targeting .netcore app 3.1 :/

had similiar problems locally at first and only way around it was to use it explicitly similiar to github actions

@timo-reymann timo-reymann deleted the feat/153-trait-support branch February 17, 2025 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants