3

I am calling python method from robot keyword. But I do not want robot framework to wait until test is finished because I want to run that method continuously. How to continue running next test case? e.g. I am calling start logs (python method) from robot keyword

def start_logs(self):
    subprocess.call('adb logcat > test.txt', shell=True)

After starting logs I want to run other test cases. But robot framework keeps waiting for above.

user2661518
  • 2,677
  • 9
  • 42
  • 79

2 Answers2

2

You can do:

def start_logs(self):
    subprocess.Popen(['adb', 'logcat', '>', 'test.txt'])

using subprocess.Popen as Colonel Thirty Two mentioned in the comments.

Community
  • 1
  • 1
arodriguezdonaire
  • 5,396
  • 1
  • 26
  • 50
  • when I run above rather than writing to file it's just printing adb logcat to console? looks like '>' is not working? – user2661518 Nov 05 '15 at 22:43
1

There is a Keyword for that! Start Process will call any keyword but will not wait for it to return. Don't forget to add the Process library to your project.

joris255
  • 155
  • 1
  • 1
  • 9