在生产环境中运行的CRM Online 2011集成测试 [英] CRM Online 2011 Integration Testing running in Production environment
问题描述
我正在为Dynamics CRM 在线 2011写一些代码。
I'm writing some code for Dynamics CRM Online 2011.
我想运行一组集成测试。 在 CRM Online中,并能够检查:
I'd like to have a set of integration tests be run in CRM Online and be able to examine:
- 某些日志输出
- 断言失败
在我的本地计算机上的测试运行程序的控制下。
Under the control of a test runner on my local machine.
现在,我在做
var passes = new List<string>();
var fails = new List<Tuple<string,Exception>>();
foreach(Action<StringWriter> testAction in EnumTests())
{
var log = stringWriter();
try
{
testAction(log);
passes.Add(log.ToString());
}
catch(Exception e)
{
fails.Add(log.ToString(),e);
}
}
throw new Exception( "PASSES: " + string.Join("======", passes.ToArray())
+ "FAILS: " + string.Join("=======",fails.Select(f=>f.ToString()).ToArray());
我通过连接到Contact Create的插件操作来触发此代码:
I trigger this code by plugin action wired to Contact Create:
- 上传插件
- 创建联系人
- 点击保存
- 下载异常数据文件
- upload the plugin
- create a contact
- hit save
- download the exception data file
必须有一种更好的方法,但是我根本无法在文档,博客或论坛中找到任何引用来触发插件代码测试(并获取异常输出)。
There has to be a better way but I simply cannot find any reference within the docs or blogs or forums) to triggering plugin code via a test (and getting exception output).
我希望能够在插件中调用一个方法,然后使结果包括完整的堆栈跟踪和日志输出返回
I want to be able to call a method in the plugin and then have the results including a full stack trace and log output arrive back within the context of a xUnit test.
有可能吗?其他人做了类似的事情吗?当然不是所有的CRM 2011开发人员都被鼠标循环卡住了吗?
Is that possible? Have others done anything similar? Surely not all CRM 2011 devs are stuck in a whackamole with a mouse loop?
NB我对调试不感兴趣前提条件,理想情况下,不必将结果存储到定制实体中。我知道我可以对页面进行屏幕抓取,但希望可以通过某种方式完成与网络服务调用相同的操作。或者某个人有一个很好的框架可以简单地完成所有工作(或者我可以调整)。
NB I'm not interested in debugging on premise and ideally would prefer not to have to store results into bespoke entities. I know I could screenscrape the page but am hoping there's some way I can do the equivalent of a webservice call. Or that someone has a nice framework that simply does it all (or I can tweak).
编辑:看来我可能最终会问下是否有人针对CRM Online有一些不错的WatiN代码
Looks like I'll probably end up asking whether anyone has some nice WatiN code against CRM Online next
推荐答案
我不确定我是否了解您要完成的所有工作,但是我根据您的评论打赌您已经看过
< codePlex上的href = http://crm2011plugintest.codeplex.com/ rel = nofollow noreferrer title = CRM 2011插件测试工具> CRM 2011插件测试工具。正如项目说明和发行说明都提到一位MS员工帮助开发了该项目,您很快就会发现MS对您所要求的支持是有限的。
I'm not sure I understand everything you're looking to accomplish, but I'm betting based on your comment that you've already had a look at CRM 2011 Plugin Testing Tools on codePlex. As the Project Description and Release Notes both mention that a MS employee helped develop that project, you can quickly see that MS's support for what you're asking for is limited.
正如乔恩·C(Jon C)所述,乔什·画家(Josh Painter)在另一个问题的答案中提到,有一个可以使用的内置插件调试器,可以在客户端计算机上执行。
As Jon C mentioned, Josh Painter mentioned in an answer to another question that there's a built-in plugin-debugger you can use, which would be executed on the client machine.
此外, Erik Pool在他的博客上发布有关手动实例化a IPluginExecutionContext
为您的插件。
Also, Erik Pool posted on his blog a great entry on manually instantiating a IPluginExecutionContext
for your plugins.
希望这三种解决方案之一都能起作用!
Hope one of these three solutions works!
这篇关于在生产环境中运行的CRM Online 2011集成测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!