使用外部服务器进行 GWT 测试
我有一个用 Python 编写的服务器代码,还有一个用 GWT 编写的客户端代码。现在我想针对来自 Python 服务器的数据在 GWT 上运行自动化测试。
根据我的搜索,人们建议使用 Selenium,但我更喜欢使用 GWT 测试,这样可以更好地了解客户端代码。这样我就可以验证本地数据库以及任何未暴露给 UI 的数据。
另外,在这一点上,我不太担心 DOM 方面、布局和其他 UI 内容。
有没有办法让 GWTTest 与外部服务器一起工作?
我试图寻找解决方案,或有类似问题的人,但我找不到。如果之前已经问过这个问题,我深表歉意。
谢谢,科康。
I have a server-code that's written in Python, and I have a client-code that's written with GWT. Now I want to run automation testing on the GWT against the data from the Python server.
From what I searched, people recommends using the Selenium, but I prefer to have a GWT-test that has more visibility into the client-code. That way I can verify the local database, and any data that are not exposed to the UI.
Also at this point I'm not too worried about the DOM aspect, layout, and the other UI stuff.
Is there anyway to make the GWTTest work with external server?
I've tried to search for the solution, or people with similar problem, but I couldn't find one. If this question has been asked previously, I apologize.
Thanks, KOkon.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 GWTTest 框架来测试一些调用服务器的 GWT 组件。但测试将无法直接与服务器通信。如果您需要测试来在服务器上设置状态,恐怕您需要编写特殊的“仅用于测试目的”的 RPC 服务器或 servlet 或类似的服务器来完成此操作。
话虽如此,我(大概像那些建议 Selenium 的人一样)推荐三种类型的测试:
You can use the GWTTest framework to incorporate testing some GWT components that call the server. But the tests won't be able to communicate directly with the server. If you need your tests to set up state on the server, I'm afraid you'll need to write special "for testing purposes only" RPC servers or servlets or similar to do it.
Having said that, I would (presumably like those who suggested Selenium) recommend three types of tests:
您可以做的是创建一个在 GWTTestCase 嵌入式 Jetty 实例中启动的代理 servlet。该代理可以将所有调用转发到 Python 中的真实服务。
What you could do is create a proxy servlet that gets started in the GWTTestCase embedded Jetty instance. That proxy could forward all calls to you real services in Python.