Posts

Showing posts with the label Testing

.NET MSTest and DeploymentItem Attribute

Image
I was recently reminded that order of operation can byte you when trying to troubleshoot intermittent unit test failures. First, I’ll be the first to admit that if you want to avoid problems with unit testing it’s best to avoid any dependency outside of your actual code base, things like databases, API and even the file system are best avoided in execution of your unit tests. That last one, the file system, in some applications is really hard to avoid. If you happen to be using MSTest, a helpful attribute for your test is DeploymentItem. This particular attribute allows you to define a file within your unit test project assuming it’s marked as “Copy Always”. With this attribute in place you can then combine this with TestContext.DeploymentDirectory to find this sample file and then do what you need to do. In my particular case I was having an issue with the unit tests failing on the build machine but not locally. After stumbling around for a bit I finally feel back to t...

People are dumb (like me)... A person is smart (like me).

Image
In the 1997 summer blockbuster "Men in Black" the two main characters, played by Will Smith and Tommy Lee Jones, discussed the capabilities of groups of people and individuals. Will Smith's character suggested that it would be safe to tell the entire earth about Aliens, saying "people are smart..." they can handle it. Tommy Lee's character responds "a person is smart, people are dumb..." which implies that while a person is capable, but as a whole people are not. In general I tend to disagree with the idea that the majority of people are dumb, stupid or some other negative quality. I strongly believe that the vast majority of people are very capable and given the right circumstance they are able to surprise, delight and in general exceed most expectations. However, keeping in mind that the "squeaky wheel gets the oil" or in other words the most vocal people get the attention, it seems for some reason that the most vocal people also tend t...