If i wanted let's say to execute test1 and to pass the result to the excel and then execute test2 and then pass the result , how would i do it? The way it is now all the tests will have to be executed together. Is that possible?
import os
import xlswriter
from datetime import datetime
import time
def save_results():
os.chdir(r'C:\Users\vrozakos\Documents\10P_Results')
workbook = xlsxwriter.Workbook(datetime_output_results+'.xlsx')
worksheet = workbook.add_worksheet()
bold = workbook.add_format({'bold': True})
worksheet.set_column('A:A', 20)
worksheet.write('B1', test_1())
worksheet.write('B2', test2())
workbook.close()
def test1():
output = str(ser.read(1000).decode())
output = str(output)
if "0x1" in output :
print('Pass')
return 'Pass'
else:
print('Fail')
return 'Fail'
def test2():
output2 = str(ser.read(1000).decode())
print(output2)
test2_output = str(output2)
if "0x1" in test2_output:
print('Pass')
return 'Pass'
else:
print('Fail')
return 'Fail'