How can I get Python to read output data from another process (in this case TeraTerm) and check it is correct?

97 views Asked by At

I have no idea where to begin.

I am trying to automate data reading testing in TeraTerm (pass data specifically).

I know what the expected output from TeraTerm should be, so is there a way I can get Python to read and check the data from TeraTerm against the payload I define as correct in Python itself?

Unfortunately i am quite new to python, and coding in general.

I was hoping to have some way of getting Python to scan TeraTerm for the desired payload (using loops perhaps) and then cross reference this against the values i set as True.

Is this doable?

1

There are 1 answers

0
Naj On

Just in case anyone ever finds this and is wondering, I did manage a work around.

I created a log file for teraterm, then after all testing was complete I simply compared the log against a pre-made .txt file containing all the correct outputs.

''''
# this isa snippet after booting teraterm and setting up a new connection
def write_TTlog():
    with pyautogui.hold('alt'):
        pyautogui.press(['f'])
    pyautogui.press('l')
    time.sleep(1)
    pyautogui.typewrite('test.log')
    pyautogui.press('return')
    time.sleep(1)    # Logging mode turned on
    pyautogui.press('left')
    pyautogui.press('return')
    time.sleep(1)
write_TTlog()
''''

''''
check = filecmp.cmp('I:\\Test\\TeraTerm Logs\\test.log', Test_file)
if check == True:
    print('\nAll Payloads match')
elif check == False:
    print('\nPayloads do not match')
''''