Use python to test Golang web services?

agolangf · · 429 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<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&#39;t think it&#39;s very common, just because it&#39;s not that much easier to do in Python than it is in Go. Sure it&#39;s a bit easier, but is it so much easier that it&#39;s worth adding another language to a project/projects just to run the tests? I don&#39;t think it is. </p></pre>rz2yoj: <pre><p>I&#39;ve certainly never seen it. And the whole &#34;Python being faster for X&#34; 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

429 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传