We have done research to Unit Testing in our company. In my company we make custom .NET, Sitefinity and especially Sitecore. We have made successfully Unit Tests for custom .NET and Sitefinity, but we could not really get to useful tests. For mocking we use Telerik JustMock and the build-in TestExplorer in Visual Studio. The reason for this was we had to mock to much and that led to useless tests almost. Actually Sitecore is a database with pages/content for each item.
Now we are going to invest time in a further research, but some experience with Unit Testing with Sitecore will be very useful. So here are my question:
- Are there more people who encountered this problem in their company?
- What approach did you choose in this situation? Or: what would you suggest be doing in our situation? Should we give up or can we get it working and in what way?
(I have already asked a question about Sitecore Unit Testing, but that was for a good tutorial how to do this: Unit Testing Sitecore using NUnit, serializing content; the answer of Shriroop was useful.)
Unit Testing is always useful for anything that is written in C# (or should I say in OO Language).
Please don't give up the idea as I am sure on StackOverFlow we have plenty of people who can help you guide in the right direction.
Please refer to this answer which I gave to this question
I would strongly recommend you watch the following videos on Youtube
And prefer reading this blog post as well
Let us know if this was helpful.
Alright, I can gauge the blockage that you are facing. But have a read of this blog post by Kevin Obee. Sometimes while doing Unit Testing we loose the focus of being pragmatic and just follow the Unit Testing Principles.
I faced that and establishing the balance would be the key. In no way I am suggesting that you might have gone in this direction, but just suggesting that sometimes taking a step back, reflecting on what we ACTUALLY want to TEST and restarting helps a lot.