<p>Hi guys,
I was just wondering how common it is, since Python is so faster to write and manipulate objects, to use Python instead of Go to exercise HTTP APIs?</p>
<hr/>**评论:**<br/><br/>juicemia: <pre><p>I wouldn't think it's very common, just because it's not that much easier to do in Python than it is in Go. Sure it's a bit easier, but is it so much easier that it's worth adding another language to a project/projects just to run the tests? I don't think it is. </p></pre>rz2yoj: <pre><p>I've certainly never seen it. And the whole "Python being faster for X" thing is a highly subjective statement.</p>
<p>Write your API tests as Go tests, using the standard <a href="https://golang.org/pkg/net/http/httptest/" rel="nofollow">net/http/httptest</a> package. Then you can share your model types, get code coverage reports, and more.</p></pre>dsmV: <pre><p>Funny, I kind of did the inverse. I wrote a go program that outputs a fairly a complicated XML string. I pipe it to a python script which sends it to a SOAP interface. I could probably just as easily write the XML generation in python, but I enjoy writing Go. However, Python has a ridiculously simple package for interacting with SOAP interfaces and I had to mock something up quickly. This was just for systems integration testing, not production by any means. </p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传