html tool

2018年9月10日星期一

fitness python use linux shell


go 一下,和语言依赖没法直接使用命令,下面这个例子是java的
If you're using Fit, you can try Bob Martin's CommandLineFixture. You can use it by creating a simple test table as follows:
| com.objectmentor.fixtures.CommandLineFixture                |
| command | C:\dev\myFileImporter.exe -f c:\dev\data\file.txt |

https://stackoverflow.com/questions/6113344/fitnesse-command-line-fixture


使用python内置方法,间接shell调用,方法如下:
 1 import subprocess
  2      
  3       
  4 def run_shell(command_list):
  5     print command_list
  6     p = subprocess.Popen(command_list, stdout=subprocess.PIPE)
  7     res = p.communicate()
  8     print res
  9     return res 
 10      
 11 if __name__=="__main__":
 12     run_shell(["bash", "/root/test/get_file"])

没有评论:

发表评论