需要实施自定义 Fitnesse 响应器

发布于 2024-08-17 20:15:36 字数 271 浏览 3 评论 0原文

我相信我需要为客户实施定制的 Fitnesse 响应器,但在我的研究/尝试中尚未取得太大成功。这个想法是,客户将拥有用 Fitnesse 编写的测试套件,但结果将通过本地 Intranet 上的 Web 服务发布到他们的数据库。我们希望通过 URL 以 RESTful 方式调用测试和/或通过 Fitnesse 页面上的另一个按钮调用自定义响应程序。理想情况下,这将运行测试、收集和解析结果,然后通过 Web 服务发布。我希望我能得到一些关于如何实现这一点的想法/提示,因为我已经束手无策了。 @_@ 任何帮助将不胜感激!谢谢!

I believe that I am in need of implementing custom Fitnesse responders for a client but have not found much success in my research/attempts to make this work. The idea is that the client will have suites of tests written in Fitnesse but that the results will be published to their database via a web service on their local intranet. We would like to either call the test via a URL in a RESTful manner and/or invoke the custom responder via another button on the Fitnesse page. Ideally this would run the test, gather and parse the results, then publish via the web service. I was hoping that I might get some ideas/hints as to how to make this happen because I'm about at my wits end. @_@ Any help would be greatly appreciated! Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我不在是我 2024-08-24 20:15:37

我一直在调查同样的事情,这就是我认为的情况......

您可以在 RESTful 庄园中调用任何 FitNesse 测试。例如,要执行测试并获取 XML 格式的结果: http://myHost:myPort/MyWikiPage ?responder=test&format=xml

有关与 FitNesse 进行 REST 交互的更多信息,请参阅 FitNesse 页面 FitNesse.UserGuide.RestfulServices。

对于您想要做的事情,这种 RESTful 方法的问题在于它需要您包装 FitNesse 的执行;这意味着,如果您希望用户能够通过正常的“转到维基并按下测试按钮”来运行测试,那么在这种情况下不会将任何结果发送到您的系统。正如您所回避的,此问题的解决方案似乎是通过自定义响应程序。

我相信答案是扩展 FitNesse Test 响应器(和 Suite 响应器)。如果您可以在现有响应程序源代码中找到可用结果,那么您应该能够重写该方法以根据需要额外处理结果并将其发送到外部系统。

响应者必须在 FitNesse 注册。这是通过名为plugin.properties 的文件(与fitnesse.jar 位于同一位置)完成的。请参阅 FitNesse 页面 FitNesse.UserGuide.PluginUsage 了解更多信息。我假设 FitNesse 允许覆盖默认响应程序,因此您在 plugin.properties 中的定义将如下所示:

Responders=test:your.package.TestResponder, suite:your.package.SuiteResponder

需要考虑的一件事是是否或者您不总是希望将结果发送到外部系统。例如,当开发测试时,将结果存储库弄乱并不总是有意义的。也许您只想在测试作为回归的一部分运行时发送结果。这些因素可能决定您选择执行的操作,例如向“测试并发送结果”添加另一个按钮,或者仅将自定义响应程序部署到您对测试进行回归的系统,或者创建一个在测试上设置为“的属性”运行时发送结果”。

我很想知道你走哪条路;如果你让响应者工作,我不介意知道你的解决方案。 :)

I've been investigating the same thing, and this is what I believe to be the case...

You can invoke any FitNesse test in a RESTful manor. E.g. To execute a test and get results in XML: http://myHost:myPort/MyWikiPage?responder=test&format=xml.

See the FitNesse page FitNesse.UserGuide.RestfulServices for more information about interacting RESTfully with FitNesse.

The problem with this RESTful approach, for what you want to do, is that it requires you to wrap the execution of FitNesse; which means that if you want users to be able to run tests through the normal Go-To-The-Wiki-And-Press-The-Test-Button, no results will be sent to your system in that case. As you eluded, the solution to this problem seems to be via custom responders.

I believe the answer is to extend the FitNesse Test responder (and the Suite responder). If you can find out in the existing responder source code where the results are available, then you should be able to override that method to additionally process the results however you need to and send them off to your external system.

Responders have to be registered with FitNesse. This is done via a file called plugin.properties (in the same location as fitnesse.jar). See the FitNesse page FitNesse.UserGuide.PluginUsage for more information. I'm assuming that FitNesse allows default responders to be overridden, so your definition in plugin.properties would look something like this:

Responders=test:your.package.TestResponder, suite:your.package.SuiteResponder

One thing to think about is whether or not you always want results sent to your external system. For example, when tests are being developed, it doesn't always make sense to clutter the result repository. Maybe you only really want to send results when the tests are run as part of a regression. These factors might dictate what you choose to do, like add another button to "Test & Send Results", or only deploy your custom responders to the systems where you regress your tests, or create a property that you set on a Test to "Send Results When Run".

I'd be curious to know which way you go; and if you get the responder to work, I wouldn't mind knowing your solution. :)

不知在何时 2024-08-24 20:15:37

我也遇到了这个问题,更多的是从 Powershell 中的命令行让 Fitnesse 以 REST 方式运行,我可以直接运行 URL 并使用 PowerShell 捕获结果,但是当使用 REST 时,我什至无法让 Powershell 连接。如果你有一种机制来运行它,我很想知道你如何做到这一点,但如果你想要的只是一种运行脚本并获取结果的方法,Powershell 可以做到这一点,你可以使用它来将结果推送到如果需要的话数据库。

I also have had trouble with this, more from just getting Fitnesse to run RESTfully from the command line in Powershell, I can run the URL's directly and have the results be captured with PowerShell but when using REST I can't even get Powershell to connect. If you have a mechanism to get this to run I'd be curious to see how you can do it, but if all you want is a way to run scripts and get results Powershell can do it and you could use it to push results to a database if you need.

晚雾 2024-08-24 20:15:37

实际上,我认为您根本不需要自定义响应程序。当您使用 Restful 服务接口运行套件时,您会得到类似于以下内容的 XML 块:

<?xml version="1.0"?>
    <suiteResults>
      <FitNesseVersion>v20100103</FitNesseVersion>
      <rootPath>MgmtSuite</rootPath>
        <pageHistoryReference>
        <name>FrontPage.MgmtSuite.GroupTest</name>
        <date>01/07/2010 09:21:46</date>
        <pageHistoryLink>FrontPage.MgmtSuite.GroupTest?pageHistory&resultDate=20100107092146</pageHistoryLink>
        <counts>
          <right>1</right>
          <wrong>1</wrong>
          <ignores>110</ignores>
          <exceptions>3</exceptions>
        </counts>
      </pageHistoryReference>
        <pageHistoryReference>
        <name>FrontPage.MgmtSuite.SchedulesTest</name>
        <date>01/07/2010 09:22:07</date>
        <pageHistoryLink>FrontPage.MgmtSuite.SchedulesTest?pageHistory&resultDate=20100107092207</pageHistoryLink>
        <counts>
          <right>1</right>
          <wrong>1</wrong>
          <ignores>344</ignores>
          <exceptions>7</exceptions>
        </counts>
      </pageHistoryReference>
        <finalCounts>
        <right>0</right>
        <wrong>2</wrong>
        <ignores>0</ignores>
        <exceptions>0</exceptions>
      </finalCounts>

    </suiteResults>

套件结果包含已运行的每个测试以及每个测试的摘要。如果您获取此 XML,您应该能够迭代每个测试,并获取页面历史记录链接,您可以使用该链接来请求该特定测试的历史记录文件。您可以指定 XML 或 HTML 作为输出,获取该结果并将其保存。

(注意,上面看到的 XML 实际上是 suiteHistory 格式,而不是直接调用套件时收到的标准 XML。一般格式是相同的)。

Pivotal Tracker 上有一个故事,其中需要能够请求测试或套件的最新运行的功能。不确定什么时候会准备好,但您可能实际上并不需要它。

Actually, I don't think you need a custom responder at all. When you use the restful services interface to run a suite, you get back a block of XML similar to the following:

<?xml version="1.0"?>
    <suiteResults>
      <FitNesseVersion>v20100103</FitNesseVersion>
      <rootPath>MgmtSuite</rootPath>
        <pageHistoryReference>
        <name>FrontPage.MgmtSuite.GroupTest</name>
        <date>01/07/2010 09:21:46</date>
        <pageHistoryLink>FrontPage.MgmtSuite.GroupTest?pageHistory&resultDate=20100107092146</pageHistoryLink>
        <counts>
          <right>1</right>
          <wrong>1</wrong>
          <ignores>110</ignores>
          <exceptions>3</exceptions>
        </counts>
      </pageHistoryReference>
        <pageHistoryReference>
        <name>FrontPage.MgmtSuite.SchedulesTest</name>
        <date>01/07/2010 09:22:07</date>
        <pageHistoryLink>FrontPage.MgmtSuite.SchedulesTest?pageHistory&resultDate=20100107092207</pageHistoryLink>
        <counts>
          <right>1</right>
          <wrong>1</wrong>
          <ignores>344</ignores>
          <exceptions>7</exceptions>
        </counts>
      </pageHistoryReference>
        <finalCounts>
        <right>0</right>
        <wrong>2</wrong>
        <ignores>0</ignores>
        <exceptions>0</exceptions>
      </finalCounts>

    </suiteResults>

The suite results contains each test that was run, and a summary of each test. If you gra this XML, you should be able to iterate through each test, and get the page history link which you can use to request the history file for that specific test. You can specify either XML or HTML as the output, take that result and save it away.

(note, the XML you see above is actually suiteHistory format instead of the standard XML that you receive back when you call the suite directly. The general format is the same).

There is a story on Pivotal Tracker where functionality is needed to be able to request the LATEST run of a test or suite. Not sure when that will be ready, but you might not actually need it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文