Sitecore单元测试不成功吗?(Sitecore Unit Testing is not a success?)

我们已经对公司的单元测试进行了研究。 在我的公司,我们制作自定义.NET,Sitefinity,特别是Sitecore。 我们成功地为自定义.NET和Sitefinity进行了单元测试,但我们无法真正进行有用的测试 。 对于模拟,我们在Visual Studio中使用Telerik JustMock和内置的TestExplorer。 这样做的原因是我们不得不嘲笑太多 ,这几乎导致无用的测试。 实际上,Sitecore是一个包含每个项目的页面/内容的数据库。

现在我们将投入时间进行进一步的研究,但是使用Sitecore进行单元测试的一些经验将非常有用。 所以这是我的问题:

是否有更多人在公司遇到此问题? 在这种情况下你选择了什么方法? 或者:你认为在我们的情况下你会做什么? 我们应该放弃,还是可以让它以何种方式运作?

(我已经问了一个关于Sitecore单元测试的问题,但那是一个很好的教程如何做到这一点: 单元测试Sitecore使用NUnit,序列化内容 ; Shriroop的答案是有用的。)

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.)

最满意答案

单元测试对于用C#编写的任何东西都是有用的(或者我应该用OO语言编写)。

请不要放弃这个想法,因为我确信在StackOverFlow上我们有很多人可以帮助您指导正确的方向。

请参考我给这个问题的 答案

我强烈建议您在Youtube上观看以下视频

codeflood 有趣的视频 。 使用Sitecore V2进行自动测试

而且更喜欢阅读这篇博客文章

我喜欢的咖啡=> Coder =>代码来自Alistair Deneys

如果这有用,请告诉我们。

好吧,我可以判断你所面临的阻塞。 但请阅读Kevin Obee撰写的这篇博客文章 。 有时在进行单元测试时,我们忽略了务实的重点,只需遵循单元测试原则。

我面对这一点,建立平衡将是关键。 我绝不建议您可能朝这个方向前进,但只是建议有时退一步,反思我们实际想要测试和重启的内容有很大帮助。

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

An interesting video by codeflood. Automated Testing with Sitecore V2

And prefer reading this blog post as well

My preferred Coffee => Coder => Code by Alistair Deneys

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.

更多推荐