Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternatives for colon replacement, which presently alters all testnames and history #72

Open
abelbraaksma opened this issue Oct 22, 2019 · 5 comments

Comments

@abelbraaksma
Copy link

abelbraaksma commented Oct 22, 2019

I'm aware of the resolved issue #68, but I'm not sure this should have gone live without a fair warning ahead, as in TeamCity, where this is typically used, this can have quite a visible impact and it effects the counting of tests (it shouldn't, but afaik TC + NUnit is not capable of distinguishing equal-named tests).

We have now three possible versions:

  • Without replacement (v1.0.2)
    • no duplicates because of no colons replacement
    • this or another older version replaced higher Unicode characters with a replacement char '?', leading also to duplicates, very good that this is resolved now
  • Replacement of colons to spaces (v1.0.4)
    • this lead to (in my case), tests like test replaceWith(':') and test replaceWith(' ') to become equal names
  • Replacement of colons to <colon> (v1.0.7)
    • no new duplicates, but sometimes replacement is <colon>, sometimes it is <colon. Not sure why, even in the same test name (if there is more than one colon)
    • searching on names with a colon in it becomes tedious
    • tests are hard to reach if you have many colons (I do, because my field is XML/XSLT/XPath and names have colons all the time)

I realize that there is no easy way out of this unless TeamCity fixes this, but since this was already reported to TC in 2012, and nothing has changed, I doubt it has much priority.

To keep the exact name, however, that link provides a workaround that goes a long way in preventing duplicates:

  • Possible solution (1), surround the test name with [ and ] (or any other bracket)
    • When a test has the name "xml:base", in namespace Tests.Base and the assembly has the name Tests.NUnit.Xml, this is reported as

        Tests.NUnit.Xml: Tests.Base.xml:base
      

      and if this changes into:

        Tests.NUnit.Xml: Tests.Base.[xml:base]
      

then TC has no problem with it anymore.

  • Possible solution (2), use ː, which is U+02D0 (MODIFIED LETTER TRIANGULAR COLON) as default character, this is available in most fonts and looks just like a normal colon, but does not have the rendering issues. The chance of conflicts after replacing are very slim, which makes it a good candidate (other colon-like candidates like U+FE55, use fixed-width, which renders rather ugly)

Last nitbit: perhaps these and other environment variables could get a public place where their meaning is explained? Searching for TEAMCITY_COLON_REPLACEMENT yields literally nothing on any search engine.

@NikolayPianikov
Copy link
Member

@abelbraaksma Thank you for your ideas. Solution 2 looks nice from my point of view. I will add variables and their descriptions to readme file.

@abelbraaksma
Copy link
Author

I just notice that that character doesn't render on Chrome on Android. Though I doubt many people run TC from Android.

(2) is easy to do, I guess, though for the long term I'd opt for solution (1). Not sure if it's hard or easy to implement though.

Thanks for looking into this :).

@Vorval0
Copy link

Vorval0 commented Jan 14, 2020

We are using TeamCity in the following scenario: failedTestName have failed in TC → get failed test names by TC API → pass --where test==failedTestName into rerun of the build configuration. Replacing : to anything breaks our scenario as NUnit can't find the failedTestName after modification.

I am aware of the Retry Attribute but it is not fit for our needs.

@abelbraaksma
Copy link
Author

abelbraaksma commented Jan 14, 2020

@Vorval0, this replacement is already active in the current TC listener. If you don't have problems now, you won't get problems later.

This proposal is about making the default more predictable,it currently is the string <colon>. With or without this change, you always have the TEAMCITY_COLON_REPLACEMENT that you can use. Set it to : and you'd be good.

@abelbraaksma
Copy link
Author

abelbraaksma commented Jan 14, 2020

Btw, the bug is with TC, which uses the colon as separator. Only when you have colons in the test name, TC screws up and reports it wrongly (see linked big report). Without the listener fixing this, you would get wrong data from the TC api anyway. It has nothing to do with NUnit, a name is a name, this doesn't affect that.

If your current setup works, you probably don't have colons in your test names. If you don't have colons, the TC listener won't change anything.

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

No branches or pull requests

3 participants