使用 REST 协议和 JSON 数据格式测试 Web 服务的最佳工具是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6151721/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 17:52:15  来源:igfitidea点击:

What are the best tools for testing web services with REST protocol and JSON data format?

jsontestingrest

提问by fmh

I am new to testing of REST web services with JSON data format.

我是使用 JSON 数据格式测试 REST Web 服务的新手。

I tried SOUPUI, but unfortunately doesn't support JSON request.

我试过 SOUPUI,但不幸的是不支持 JSON 请求。

I am now using the Chrome plugin for my tests, but I think it's not appropriate for test automation of these type of applications.

我现在使用 Chrome 插件进行测试,但我认为它不适合此类应用程序的测试自动化。

Does anybody know which tools are OK for this purpose?

有人知道哪些工具可以用于此目的吗?

回答by Grooveek

We're using RestClientfor testing our Rest/JSON WebServices. It's very handy and easy to use

我们使用RestClient来测试我们的 Rest/JSON WebServices。它非常方便且易于使用

回答by Jonas S?derstr?m

A nifty framework/library for testing REST with json is "rest-assured"
http://code.google.com/p/rest-assured/

使用 json 测试 REST 的漂亮框架/库是“放心的”
http://code.google.com/p/rest-assured/

Inspired by BDD and Groovy ( but it's Java ) it makes it easy to test REST resources

受 BDD 和 Groovy(但它是 Java)的启发,它可以轻松测试 REST 资源

given().
        param("key1", "value1").
        param("key2", "value2").
expect().
        body(containsString("OK")).
when().
        post("/somewhere");


And it's easy to work with JSON path


使用 JSON 路径很容易

// Example with JsonPath
String json = get("/lotto").asString()
List<String> winnderIds = from(json).get("lotto.winners.winnerId");


Getting started is easy.
http://code.google.com/p/rest-assured/wiki/GettingStarted


入门很容易。
http://code.google.com/p/rest-assured/wiki/GettingStarted

Disclaimer
rest-assured is founded and managed by the Company I work for.

免责声明
rest-assured 由我工作的公司创立和管理。

回答by Joxi

One such tool is HttpMaster.

一种这样的工具是HttpMaster

It's quite flexible regarding REST API testing and has good JSON/XML support. For advanced test scenarios, you can define response data validations and establish chains of multiple requests. The only possible drawback is that it runs on Windows only.

它在 REST API 测试方面非常灵活,并且具有良好的 JSON/XML 支持。对于高级测试场景,您可以定义响应数据验证并建立多个请求链。唯一可能的缺点是它只能在 Windows 上运行。

回答by Pradeep

There are few plugins which can be added for SOAP UI so that Json files can be accessed.

可以为 SOAP UI 添加的插件很少,以便可以访问 Json 文件。