Что лучший способ состоит в том, чтобы записать тестовому сценарию для веб-сервисов RESTLET?

Try

$('#anchorID').is('[disabled=disabled]')

Вернет true, если disabled="disabled" является атрибутом элемента.

8
задан IgorM 26 May 2009 в 17:22
поделиться

2 ответа

Restlet lets you run your web services on various server "connectors", and it is quite easy to switch from one server to another. We normally run our web services on a Sun Glassfish Java EE application server cluster, but for testing them we use a connector that links with the Simple HTTP Server to run the web services as a standalone application. There also are server connectors for AsyncWeb, Jetty, Grizzly, and an internal HTTP server.

On the client side, you should consider the Restlet client library. It's pretty concise and it's designed to mesh well with Restlet servers. We use the Apache HTTP Client connector.

For testing, we've created the Fetcher class. This is implemented using the Restlet client API. To use it, you pretty much call the fetch() method:

DTO person = fetch("/employee/1234");
DTO department = fetch("/department/" + person.getDepartment());

Fetch() tacks the given resource name onto the base URI of the web services (say "http://localhost:8182"), uses the Restlet client API to fetch an XML representation, then deserializes the fetched XML into a data transfer object (a POJO).

You can see that this really makes unit testing quite easy. Before the unit tests, you fire up the web services on a standalone server like Simple or Jetty. During the unit tests you fetch DTOs, DOM trees, json.org objects or whatever using Fetcher, then apply test assertions to to what was returned. If you need to test at a more detailed level, you can use the Restlet client code directly.

0
ответ дан 6 December 2019 в 02:26
поделиться

@see http://www.restlet.org/documentation/1.1/firstSteps#part04

Вы должны быть в состоянии запустить службу Restlet встроенным способом и использовать apache HttpClient для вызова методов. Я так и сделал, и это довольно просто.

1
ответ дан 6 December 2019 в 02:26
поделиться
Другие вопросы по тегам:

Похожие вопросы: