简单的网络服务器或网络测试框架 [英] Simple webserver or web testing framework
问题描述
需要测试一个复杂的 web 应用程序,它与远程 3rd 方基于 cgi 的 web 服务进行一些交互.我打算在一个虚拟的网络服务器中实现一些 3rd 方服务,这样我就可以完全控制测试用例.寻找一个简单的 python http 网络服务器或框架来模拟 3rd 方界面.
Need to testcase a complex webapp which does some interacting with a remote 3rd party cgi based webservices. Iam planing to implement some of the 3rd party services in a dummy webserver, so that i have full controll about the testcases. Looking for a simple python http webserver or framework to emulate the 3rd party interface.
推荐答案
使用cherrypy,看看Hello World:
Use cherrypy, take a look at Hello World:
import cherrypy
class HelloWorld(object):
def index(self):
return "Hello World!"
index.exposed = True
cherrypy.quickstart(HelloWorld())
运行此代码,您就可以在 localhost
端口 8080
上准备好一个非常快的 Hello World 服务器!!很简单吧?
Run this code and you have a very fast Hello World server ready on localhost
port 8080
!! Pretty easy huh?
这篇关于简单的网络服务器或网络测试框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!