The Magnificent Sixteen


GUIDs are precious little things. Useful, annoying at times, but lovable nonetheless. Cherish them as if they were unique (all pun intended) and they will pay your love back.

I am one of those who despises wasting GUIDs. Some would go even further: They will say I am afraid that we are going to run out of them.
Reality is, I firmly believe they have a higher purpose in life than being stuck in some obscure testing project, never seeing the “production light”, test run, after test run, after test run…
But just imagine this other equally terrible fate: being born for a split second of a test run and die after it finished. The paradigm of purposeless life: be born in pain (and wasted CPU cycles), enjoy a brief life (microseconds) while the test runs, be in the middle of action without being noticed and die. No one remembers you. No one ever ask you what your value was. You are irrelevant, Dispensable. A mere thing used for the sole purpose of not using The One Whose Name Cannot Be Mentioned:


These apocalyptic scenarios are everywhere around us:

  • developers that use GUID generation shortcuts in test projects are preventing those otherwise very capable entities to be born where they are most needed: production code. new Guid(“somethingThatWasCopiedFromATool”)
  • Some sadistic developers even generate new GUIDS for every run of the test! Heartless, cold-blooded GUID murderers, that will burn in hell listening to their victim’s screams, if you ask me. Guid.NewGuid()

Stop the Slaughter

I cannot tell how many unborn GUIDs I have saved with my own hands. But I felt I could do better. How many times I have dreamt of using a team of well-trained GUIDs that can stop the massacre? Loads. But know I moved my lazy developer-ass and share with you someone that can introduce you to The Magnificent Sixteen: GuidBuilder.

My experience tells me that in most test one does not need trillions of GUIDs to compare. An upper limit close to the dozen is more accurate. Beyond that limit, I am in a position to assure you are getting yourself into a big mess with that test. But that dozen or so are important for your test scenario. You are probably identifying some objects with those, so it is important that:

  1. they are different
  2. no innocent GUID suffers

You can use GuidBuilder.Build() to create one of the Magnificent Sixteen. An hexadecimal figure is all you need, and a GUID with all digits set to that figure will be created. Pass it as a char or a byte.

Where Do I Sign?

Luckily, no signature is needed. You get it alongside the rest of the wonders of Testing.Commons in their latest version (via Nuget Package.

Use it. Save those GUIDs. Delay the Doomsday that will happen when we run out of them. Decrease that crazy entropy growth. But remember, if it is not hexadecimal (0 to 15 or '0' to 'F'), it is not one of the Magnificent Sixteen.