通过 Fitnesse 测试第三方 API
我们必须测试远程机器上的一些 API,这些 API 需要使用 Fitnesse 进行测试。
我们有一些先决条件。
- 我们需要使用 Web 服务来测试这些 API。 API 的 jar(比如 xyz.jar)位于服务器端。 Web服务要部署在哪里。
- 必须使用 Fitnesse 给出输入。并且 xyz.jar 在fitnesse端不可用。因为客户端 Fitnesse 需要独立于 xyz.jar 中的更改,因此它使其对所有未来版本通用。
- 用户将在 wiki 页面中给出要测试什么类的什么方法以及输入数据。
这里的一个假设是使用 wiki 页面上给出的输入值和 API 名称:通过反射,将从 Web 服务调用 API。
数据流示例
|健身| -----> |业务层| --> |网络服务代理 | --------> |网络服务| --------> | xyz.jar |
我们面临着一些问题,例如。
一些 API 就像 doSomething(CustomId someId, DBLoaderType type, DBFilter filter, boolean exclus) 返回 java.util.List 但这些 CustomId、DBLoaderType、DBFilter、SomeNavigationSystem 不是可序列化的对象。
某些 API 返回的值可以是 Java 原语、包装器或自定义对象或自定义对象集合类型。 (布尔值、布尔值、列表映射、映射> 如何验证返回类型?
我们面临的一个问题是:如何将fitnesse的输入数据输入到java层(这将调用webservice来测试API)如果API的类型为registerUsersForMessage(int messageId,List users,boolean forceRegister, int maxBatch, Map ) 如何将这些数据从fitnesse wiki页面传递到java层?有没有办法将输入数据推送到“某个地方”,以便测试人员的 wiki 页面变得干净?
欢迎对此提供任何帮助。或者任何可能导致头脑风暴的问题也都受到欢迎。 提前致谢。
we have to test few of the APIs which are lying on the remote machine which needs to be tested using fitnesse.
We have some pre conditions.
- We need to use webservices for testing these APIs. And API's jar (say xyz.jar) lies on the server side. Where webservice is to be deployed.
- Inputs have to be given using fitnesse. And xyz.jar is not available on the fitnesse side. Because client fitnesse needs to be independent of the changes in the xyz.jar and hence it makes it generic for all future versions.
- User will give what method of what class is to be tested along with input data in the wiki page.
One assumption here is using the input values and API name given on wiki page: through reflection that API will be invoked from the webservice.
SAMPLE DATA FLOW
| Fitness | ----- > | Business layer | --> | Webservice Proxy | -------> | Webservice | -------> | xyz.jar |
We are facing some issues like.
Some of the APIs are are like doSomething(CustomId someId, DBLoaderType type, DBFilter filter, boolean exclude) returns java.util.List But these CustomId, DBLoaderType, DBFilter, SomeNavigationSystem are not serializable objects.
Some of the APIs return the values which can be of type Java primitives, wrapper or custom objects or Collection of custom objects. (boolean, Boolean, List Map , Map>
How to verify the return types?One issue we are facing is : how to input the input data from fitnesse to java layer (which will make a call to webservice to testthe API) If the API is of type registerUsersForMessage (int messageId, List users, boolean forceRegister, int maxBatch, Map ) how to pass such data to java layer from fitnesse wiki page? Is there any way to push the input data 'somewhere' so that tester's wiki page will be clean?
Any help for this is welcome. Or any questions which may lead to brainstorm awe welcome too.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定您在这里测试的是哪种应用程序,但我强烈建议您仅保留 Fitnesse 测试页面中的业务细节和逻辑,并将所有有关 API 和其他技术细节的内容移至固定代码中。它使灯具变得更加复杂,但它们所处的环境中您拥有一整套强大的工具来管理这种复杂性。
如果您正在考虑验证 API 函数的返回类型,那么这听起来像是一种完全不同类型的测试。
事实上,涉及到使您的应用程序正常工作的 Web 服务对于 Fitnesse 测试来说应该是透明的,除非您正在测试 Web 服务本身。
I'm not sure what kind of app you're testing here, but I strongly recommend that you keep only the business details and logic in the Fitnesse test pages, and move all of the stuff about APIs and other technical details into the fixture code. It makes the fixtures more complex, but they're in an environment where you've got a full set of powerful tools to manage that complexity.
If you're thinking at the level of verifying the return types from the API functions, that sounds like a completely different kind of test.
The fact that there is a webservice involved to make your application work should be transparent to the Fitnesse tests, unless you're testing the web service itself.