How To Get The Result Of A Ran Robot File Using Popen












0















I want to be able to retrieve the result (whether it passed or it failed) of the robot test that is ran using popen. I want to use popen to support dialog boxes and tests that are not dialog boxes. Is there any way to retrieve the result? I am using the code from this page here (link).



import sys
import subprocess

my_path = sys.executable
def run_process(command):
print("Running command: " + command)
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)

while True:
if sys.version_info >= (3, 0):
nextline = str(p.stdout.readline(),"utf-8")
else:
nextline = p.stdout.readline()
if nextline == '' and p.poll() is not None:
break
sys.stdout.write(nextline)
sys.stdout.flush()

python_path = my_path + ' -m robot.run'
Location ='C:/Users/Desktop/pass_or_fail.robot'
command=python_path+' '+Location
run_process(command)
print(my_path)









share|improve this question























  • Can you highlight what is not working for you? I.e. what’s the error you’re facing?

    – A. Kootstra
    Nov 13 '18 at 16:50


















0















I want to be able to retrieve the result (whether it passed or it failed) of the robot test that is ran using popen. I want to use popen to support dialog boxes and tests that are not dialog boxes. Is there any way to retrieve the result? I am using the code from this page here (link).



import sys
import subprocess

my_path = sys.executable
def run_process(command):
print("Running command: " + command)
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)

while True:
if sys.version_info >= (3, 0):
nextline = str(p.stdout.readline(),"utf-8")
else:
nextline = p.stdout.readline()
if nextline == '' and p.poll() is not None:
break
sys.stdout.write(nextline)
sys.stdout.flush()

python_path = my_path + ' -m robot.run'
Location ='C:/Users/Desktop/pass_or_fail.robot'
command=python_path+' '+Location
run_process(command)
print(my_path)









share|improve this question























  • Can you highlight what is not working for you? I.e. what’s the error you’re facing?

    – A. Kootstra
    Nov 13 '18 at 16:50
















0












0








0








I want to be able to retrieve the result (whether it passed or it failed) of the robot test that is ran using popen. I want to use popen to support dialog boxes and tests that are not dialog boxes. Is there any way to retrieve the result? I am using the code from this page here (link).



import sys
import subprocess

my_path = sys.executable
def run_process(command):
print("Running command: " + command)
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)

while True:
if sys.version_info >= (3, 0):
nextline = str(p.stdout.readline(),"utf-8")
else:
nextline = p.stdout.readline()
if nextline == '' and p.poll() is not None:
break
sys.stdout.write(nextline)
sys.stdout.flush()

python_path = my_path + ' -m robot.run'
Location ='C:/Users/Desktop/pass_or_fail.robot'
command=python_path+' '+Location
run_process(command)
print(my_path)









share|improve this question














I want to be able to retrieve the result (whether it passed or it failed) of the robot test that is ran using popen. I want to use popen to support dialog boxes and tests that are not dialog boxes. Is there any way to retrieve the result? I am using the code from this page here (link).



import sys
import subprocess

my_path = sys.executable
def run_process(command):
print("Running command: " + command)
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)

while True:
if sys.version_info >= (3, 0):
nextline = str(p.stdout.readline(),"utf-8")
else:
nextline = p.stdout.readline()
if nextline == '' and p.poll() is not None:
break
sys.stdout.write(nextline)
sys.stdout.flush()

python_path = my_path + ' -m robot.run'
Location ='C:/Users/Desktop/pass_or_fail.robot'
command=python_path+' '+Location
run_process(command)
print(my_path)






python robotframework






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 15:27









S.McWhorterS.McWhorter

818




818













  • Can you highlight what is not working for you? I.e. what’s the error you’re facing?

    – A. Kootstra
    Nov 13 '18 at 16:50





















  • Can you highlight what is not working for you? I.e. what’s the error you’re facing?

    – A. Kootstra
    Nov 13 '18 at 16:50



















Can you highlight what is not working for you? I.e. what’s the error you’re facing?

– A. Kootstra
Nov 13 '18 at 16:50







Can you highlight what is not working for you? I.e. what’s the error you’re facing?

– A. Kootstra
Nov 13 '18 at 16:50














1 Answer
1






active

oldest

votes


















0














If the tests passes or fails it can be stored as an integer. For example, a 0 represents that the test passed and anything greater than 0 represents that the test failed. That's why I used:



output = p.communicate()[0]
rc = p.returncode



import sys
import subprocess

my_path = sys.executable
def run_process(command):
global output
global rc
print("Running command: " + command)
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)

while True:
if sys.version_info >= (3, 0):
nextline = str(p.stdout.readline(),"utf-8")
else:
nextline = p.stdout.readline()
if nextline == '' and p.poll() is not None:
break
sys.stdout.write(nextline)
sys.stdout.flush()
output = p.communicate()[0]
rc = p.returncode
python_path = my_path + ' -m robot.run'
Location ='C:/Users/Desktop/pass_or_fail.robot'
command=python_path+' '+Location
run_process(command)
print(my_path)
print(rc)





share|improve this answer





















  • 1





    The return code is the number of failed cases - 0 means zero failed, X - that X failed. If your suite had a single case, that may have mislead you into thinking the RC is either 0 or 1. There's some more info in the user guide.

    – Todor Minakov
    Nov 13 '18 at 17:44











  • Good catch, thank you!

    – S.McWhorter
    Nov 13 '18 at 17:55











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284292%2fhow-to-get-the-result-of-a-ran-robot-file-using-popen%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














If the tests passes or fails it can be stored as an integer. For example, a 0 represents that the test passed and anything greater than 0 represents that the test failed. That's why I used:



output = p.communicate()[0]
rc = p.returncode



import sys
import subprocess

my_path = sys.executable
def run_process(command):
global output
global rc
print("Running command: " + command)
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)

while True:
if sys.version_info >= (3, 0):
nextline = str(p.stdout.readline(),"utf-8")
else:
nextline = p.stdout.readline()
if nextline == '' and p.poll() is not None:
break
sys.stdout.write(nextline)
sys.stdout.flush()
output = p.communicate()[0]
rc = p.returncode
python_path = my_path + ' -m robot.run'
Location ='C:/Users/Desktop/pass_or_fail.robot'
command=python_path+' '+Location
run_process(command)
print(my_path)
print(rc)





share|improve this answer





















  • 1





    The return code is the number of failed cases - 0 means zero failed, X - that X failed. If your suite had a single case, that may have mislead you into thinking the RC is either 0 or 1. There's some more info in the user guide.

    – Todor Minakov
    Nov 13 '18 at 17:44











  • Good catch, thank you!

    – S.McWhorter
    Nov 13 '18 at 17:55
















0














If the tests passes or fails it can be stored as an integer. For example, a 0 represents that the test passed and anything greater than 0 represents that the test failed. That's why I used:



output = p.communicate()[0]
rc = p.returncode



import sys
import subprocess

my_path = sys.executable
def run_process(command):
global output
global rc
print("Running command: " + command)
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)

while True:
if sys.version_info >= (3, 0):
nextline = str(p.stdout.readline(),"utf-8")
else:
nextline = p.stdout.readline()
if nextline == '' and p.poll() is not None:
break
sys.stdout.write(nextline)
sys.stdout.flush()
output = p.communicate()[0]
rc = p.returncode
python_path = my_path + ' -m robot.run'
Location ='C:/Users/Desktop/pass_or_fail.robot'
command=python_path+' '+Location
run_process(command)
print(my_path)
print(rc)





share|improve this answer





















  • 1





    The return code is the number of failed cases - 0 means zero failed, X - that X failed. If your suite had a single case, that may have mislead you into thinking the RC is either 0 or 1. There's some more info in the user guide.

    – Todor Minakov
    Nov 13 '18 at 17:44











  • Good catch, thank you!

    – S.McWhorter
    Nov 13 '18 at 17:55














0












0








0







If the tests passes or fails it can be stored as an integer. For example, a 0 represents that the test passed and anything greater than 0 represents that the test failed. That's why I used:



output = p.communicate()[0]
rc = p.returncode



import sys
import subprocess

my_path = sys.executable
def run_process(command):
global output
global rc
print("Running command: " + command)
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)

while True:
if sys.version_info >= (3, 0):
nextline = str(p.stdout.readline(),"utf-8")
else:
nextline = p.stdout.readline()
if nextline == '' and p.poll() is not None:
break
sys.stdout.write(nextline)
sys.stdout.flush()
output = p.communicate()[0]
rc = p.returncode
python_path = my_path + ' -m robot.run'
Location ='C:/Users/Desktop/pass_or_fail.robot'
command=python_path+' '+Location
run_process(command)
print(my_path)
print(rc)





share|improve this answer















If the tests passes or fails it can be stored as an integer. For example, a 0 represents that the test passed and anything greater than 0 represents that the test failed. That's why I used:



output = p.communicate()[0]
rc = p.returncode



import sys
import subprocess

my_path = sys.executable
def run_process(command):
global output
global rc
print("Running command: " + command)
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)

while True:
if sys.version_info >= (3, 0):
nextline = str(p.stdout.readline(),"utf-8")
else:
nextline = p.stdout.readline()
if nextline == '' and p.poll() is not None:
break
sys.stdout.write(nextline)
sys.stdout.flush()
output = p.communicate()[0]
rc = p.returncode
python_path = my_path + ' -m robot.run'
Location ='C:/Users/Desktop/pass_or_fail.robot'
command=python_path+' '+Location
run_process(command)
print(my_path)
print(rc)






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 13 '18 at 17:54

























answered Nov 13 '18 at 17:04









S.McWhorterS.McWhorter

818




818








  • 1





    The return code is the number of failed cases - 0 means zero failed, X - that X failed. If your suite had a single case, that may have mislead you into thinking the RC is either 0 or 1. There's some more info in the user guide.

    – Todor Minakov
    Nov 13 '18 at 17:44











  • Good catch, thank you!

    – S.McWhorter
    Nov 13 '18 at 17:55














  • 1





    The return code is the number of failed cases - 0 means zero failed, X - that X failed. If your suite had a single case, that may have mislead you into thinking the RC is either 0 or 1. There's some more info in the user guide.

    – Todor Minakov
    Nov 13 '18 at 17:44











  • Good catch, thank you!

    – S.McWhorter
    Nov 13 '18 at 17:55








1




1





The return code is the number of failed cases - 0 means zero failed, X - that X failed. If your suite had a single case, that may have mislead you into thinking the RC is either 0 or 1. There's some more info in the user guide.

– Todor Minakov
Nov 13 '18 at 17:44





The return code is the number of failed cases - 0 means zero failed, X - that X failed. If your suite had a single case, that may have mislead you into thinking the RC is either 0 or 1. There's some more info in the user guide.

– Todor Minakov
Nov 13 '18 at 17:44













Good catch, thank you!

– S.McWhorter
Nov 13 '18 at 17:55





Good catch, thank you!

– S.McWhorter
Nov 13 '18 at 17:55


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284292%2fhow-to-get-the-result-of-a-ran-robot-file-using-popen%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Florida Star v. B. J. F.

Error while running script in elastic search , gateway timeout

Adding quotations to stringified JSON object values