基于Fitnesse的接口自动化测试-官方文档解读-RestfulServices

文档

RestfulServices

解读

 可以利用FitNesse提供的Responders,通过Http方式,访问FitNesse相关内容。

列举一些我用到的Responders

addChild 在某个路径下添加一个page

例子:http://myHost:myPort/AutoAdmin.TestCase.20200330?addChild&pageName="test1"&pageType="Test"&pageContent="用例内容"

  • AutoAdmin.TestCase.20200330 SuitePage (这里是个例子)
  • pageName:指定页面名称
  • pageType : 指定页面类型
  • pageContent:指定页面初始内容
  1. page有三种类型,Test, Suite, Static。 Static是不能执行的,Test和Suite可以执行。它们都可以在下面创建子page,但是不建议在Test下再创建page。
  2. 在使用时,可以将Suite, Static理解成文件夹,按照上面的例子,先创建了Static类型的AutoAdmin,接着分别创建Suite类型的TestCase和20200330,最后才调用上面的请求,创建了Test类型的Test1。

deletePage 删除指定page

例子:http://myHost:myPort/AutoAdmin.TestCase.20200330.Test1?deletePage&confirmed=yes

  • AutoAdmin.TestCase.20200330.Test1 TestPage
  • confirmed:跳过确认页面

pageHistory 查看用例历史执行记录

例子:http://myHost:myPort/AutoAdmin.TestCase.20200330.Test1?pageHistory&resultDate=20200220111928

  • AutoAdmin.TestCase.20200330.Test1 TestPage
  • resultDate: 指定日期,如果使用latest,表示最近一次记录

test 执行单条用例

例子:http://myHost:myPort/AutoAdmin.TestCase.20200330.Test1?test&format=xml

  • AutoAdmin.TestCase.20200330.Test1 TestPage
  • format: 指定返回结果格式

suite 执行多条用例(也可以单条)

例子:http://myHost:myPort/AutoAdmin.TestCase.20200330?suite&format=xml

  • AutoAdmin.TestCase.20200330 SuitePage
  • format: 指定返回结果格式

说明

 1.上面列举的API都是常用的内容,API还有很多,可以查看官方文档
 2.我利用了本功能,实现了FitNesse和测试平台的交互。

posted @ 2020-08-01 11:30  月色深潭  阅读(188)  评论(0编辑  收藏  举报