Have you seem this error UTA004: Illegal use of attribute on testmethod. The TestMethodAttribute can be defined only inside a class marked with the TestClass attribute. while trying to run a mstest unit test.
The common scenario when this occurs is if there is a method with [TestMethod] attribute but the class in which it is defined does not have [TestClass] attribute.
However, even if you add the [TestClass] attribute and the error does not go away, the reason is that the class is not public.
Hence, make sure that the class is public and it has [TestClass] attribute.
The common scenario when this occurs is if there is a method with [TestMethod] attribute but the class in which it is defined does not have [TestClass] attribute.
However, even if you add the [TestClass] attribute and the error does not go away, the reason is that the class is not public.
Hence, make sure that the class is public and it has [TestClass] attribute.
Awesome! Thanks so much. I guess it needs to be public so that the test runner executable can see it.
ReplyDeleteAwesome! Thanks so much. I guess it needs to be public so that the test runner executable can see it.
ReplyDeleteThanks so much
ReplyDeleteThanks that fixed the problem for me.
ReplyDeleteThanks! Saved me a lot of frustration.
ReplyDeleteThanks. helped a lot.
ReplyDeletemany thanks
ReplyDeleteThanks a lot. Saved my day.
ReplyDeleteThanks.. This information helped me.
ReplyDeletethanks
ReplyDeleteIt helped a lot. Thanks!
ReplyDeleteThanks.
ReplyDeletethanks.
ReplyDeletethanks! :)
ReplyDeleteThank you very much :)
ReplyDeleteThanks
ReplyDeleteThanks that helped
ReplyDeleteThank You. :-)
ReplyDeleteThanks , that did the trick !!!
ReplyDeleteThere's another scenario where you can get this error with a TestClass attribute defined - if you have a DeploymentItem attribute with a disallowed output path like @"\" then you'll get this error.
ReplyDeleteThere's another scenario where you can get this error with a TestClass attribute defined - if you have a DeploymentItem attribute with a disallowed output path like @"\" then you'll get this error.
ReplyDeleteSame issue I got and resolved.. Thank you!
ReplyDelete