This commit is contained in:
boccioli_m
2017-05-16 11:44:07 +02:00
parent e77d7fc626
commit ee7698ccdc
41 changed files with 101 additions and 93 deletions
@@ -35,7 +35,7 @@ def startTest(testName, DEVICE, params):
test.getPath() string, path of this test file
test.getName() string, name of this test
test.getDeviceName() string, device for which the test must run (typically it is the beginning of a process variable name)
test.getPlotName() string, name to be given to the plot when using setPlotName(). Example: scan.setPlotName(test.getPlotName())
test.getPlotName() string, name to be given to the plot when using setPlotTitle(). Example: scan.setPlotTitle(test.getPlotName())
-----------------------------------
GETTING TEST PARAMETERS:
-----------------------------------
@@ -84,7 +84,7 @@ def startTest(testName, DEVICE, params):
# initialise plot tab with 2 plots: pass here the axis names:
scan = ManualScan(['sample'], ['Status (MSTA)', 'Position (VAL)'])
# set plot name(tab title):
scan.setPlotName(test.getPlotName())
scan.setPlotTitle(test.getPlotName())
# start plots. See further below how to add points to the plots (scan):
scan.start()
@@ -14,7 +14,7 @@ def startTest(testName, DEVICE, params):
# by default, assume the test failed
ret = 'Test failed'
status = False
# plot name to be given to the scan. Use: scan.setPlotName(plotName)
# plot name to be given to the scan. Use: scan.setPlotTitle(plotName)
plotName = DEVICE + ' - ' + testName
# put the whole custom code under try/catch
try:
@@ -110,6 +110,7 @@ def startTest(testName, DEVICE, params):
test.sendFeedback(ret, success)
except (KeyboardInterrupt):
# user stop error handler
import traceback
ret = 'Test stopped by user.'
success = False
test.sendFeedback(ret, success)
@@ -19,7 +19,7 @@ def startTest(testName, DEVICE, params):
#by default, failed
ret = 'Test failed'
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
#plot name to be given to the scan. Use: scan.setPlotTitle(plotName)
plotName = DEVICE + ' - ' + testName
#########################################
###### WRITE YOUR CODE HERE BELOW #######
@@ -29,7 +29,7 @@ def startTest(testName, DEVICE, params):
print_log(testName, DEVICE, 'device: ' + DEVICE )
#scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'] , [0.0], [30.0], [20])
scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'])
scan.setPlotName(plotName)
scan.setPlotTitle(plotName)
scan.start()
try:
#Creating channels: dimension 1
@@ -27,7 +27,7 @@ def startTest(testName, DEVICE, params):
#by default, failed
ret = 'Test failed'
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
#plot name to be given to the scan. Use: scan.setPlotTitle(plotName)
plotName = DEVICE + ' - ' + testName
#########################################
###### WRITE YOUR CODE HERE BELOW #######
@@ -37,7 +37,7 @@ def startTest(testName, DEVICE, params):
print_log(testName, DEVICE, 'device: ' + DEVICE )
#scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'] , [0.0], [30.0], [20])
scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'])
scan.setPlotName(plotName)
scan.setPlotTitle(plotName)
scan.start()
try:
@@ -7,7 +7,7 @@ def startTest(testName, DEVICE, params):
#by default, assume the test failed
ret = 'Test failed'
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
#plot name to be given to the scan. Use: scan.setPlotTitle(plotName)
plotName = DEVICE + ' - ' + testName
#put the whole custom code under try/catch
try:
@@ -22,7 +22,7 @@ def startTest(testName, DEVICE, params):
test.log( 'device: ' + DEVICE )
#scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'] , [0.0], [30.0], [20])
scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'])
scan.setPlotName(plotName)
scan.setPlotTitle(plotName)
scan.start()
try:
@@ -102,11 +102,13 @@ def startTest(testName, DEVICE, params):
test.sendFeedback(ret, success)
except (KeyboardInterrupt):
#user stop error handler
import traceback
ret = 'Test stopped by user.'
success = False
test.sendFeedback(ret, success)
except:
#generic error handler
import traceback
ret = traceback.format_exc()
success = False
test.sendFeedback(ret, success)
@@ -26,7 +26,7 @@ def startTest(testName, DEVICE, params):
#by default, failed
ret = 'Test failed'
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
#plot name to be given to the scan. Use: scan.setPlotTitle(plotName)
plotName = DEVICE + ' - ' + testName
######### WRITE YOUR CODE HERE BELOW #############
print_log(testName, DEVICE, 'testpath B: ' + testPath )
@@ -34,7 +34,7 @@ def startTest(testName, DEVICE, params):
print_log(testName, DEVICE, 'device: ' + DEVICE )
#scan = ManualScan(['time'], ['SetVB', 'ActualVB', 'ActualIB'] , [0.0], [30.0], [20])
scan = ManualScan(['time'], ['SetVB', 'ActualVB', 'ActualIB'] )
scan.setPlotName(plotName)
scan.setPlotTitle(plotName)
scan.start()
#Creating channels: dimension 1
@@ -7,7 +7,7 @@ def startTest(testName, DEVICE, params):
#by default, assume the test failed
ret = 'Test failed'
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
#plot name to be given to the scan. Use: scan.setPlotTitle(plotName)
plotName = DEVICE + ' - ' + testName
#put the whole custom code under try/catch
try:
@@ -22,7 +22,7 @@ def startTest(testName, DEVICE, params):
test.log( 'device: ' + DEVICE )
#scan = ManualScan(['time'], ['SetVB', 'ActualVB', 'ActualIB'] , [0.0], [30.0], [20])
scan = ManualScan(['time'], ['SetVB', 'ActualVB', 'ActualIB'] )
scan.setPlotName(plotName)
scan.setPlotTitle(plotName)
scan.start()
#Creating channels: dimension 1
@@ -41,6 +41,7 @@ def startTest(testName, DEVICE, params):
ActualIA = Channel(DEVICE + ':Actual-IB', type = 'd')
#ActualIA = Channel('pw84:ai', type = 'd')
except:
import traceback
test.sendFeedback( 'Unable to create channel - ' + traceback.format_exc(), False)
return
#Init
@@ -97,11 +98,13 @@ def startTest(testName, DEVICE, params):
test.sendFeedback(ret, success)
except (KeyboardInterrupt):
#user stop error handler
import traceback
ret = 'Test stopped by user.'
success = False
test.sendFeedback(ret, success)
except:
#generic error handler
import traceback
ret = traceback.format_exc()
success = False
test.sendFeedback(ret, success)
@@ -9,7 +9,7 @@ def startTest(testName, DEVICE, params):
#by default, assume the test failed
ret = 'Test failed'
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
#plot name to be given to the scan. Use: scan.setPlotTitle(plotName)
plotName = DEVICE + ' - ' + testName
#put the whole custom code under try/catch
try:
@@ -74,7 +74,7 @@ def startTest(testName, DEVICE, params):
#initialise plot tab with 2 plots
scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] )
#set plot name(tab title)
scan.setPlotName(plotName + "Manual Scan")
scan.setPlotTitle(plotName + "Manual Scan")
#start plots. See further below how to add points to the plots
scan.start()
@@ -9,7 +9,7 @@ def startTest(testName, DEVICE, params):
#by default, assume the test failed
ret = 'Test failed'
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
#plot name to be given to the scan. Use: scan.setPlotTitle(plotName)
plotName = DEVICE + ' - ' + testName
#put the whole custom code under try/catch
try:
@@ -74,7 +74,7 @@ def startTest(testName, DEVICE, params):
#initialise plot tab with 2 plots
scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] )
#set plot name(tab title)
scan.setPlotName(plotName + " Manual Scan")
scan.setPlotTitle(plotName + " Manual Scan")
#start plots. See further below how to add points to the plots
scan.start()
@@ -9,7 +9,7 @@ def startTest(testName, DEVICE, params):
#by default, assume the test failed
ret = 'Test failed'
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
#plot name to be given to the scan. Use: scan.setPlotTitle(plotName)
plotName = DEVICE + ' - ' + testName
#put the whole custom code under try/catch
try:
@@ -74,7 +74,7 @@ def startTest(testName, DEVICE, params):
#initialise plot tab with 2 plots
scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] )
#set plot name(tab title)
scan.setPlotName(plotName + "Manual Scan")
scan.setPlotTitle(plotName + "Manual Scan")
#start plots. See further below how to add points to the plots
scan.start()
@@ -9,7 +9,7 @@ def startTest(testName, DEVICE, params):
#by default, assume the test failed
ret = 'Test failed'
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
#plot name to be given to the scan. Use: scan.setPlotTitle(plotName)
plotName = DEVICE + ' - ' + testName
#put the whole custom code under try/catch
try:
@@ -74,7 +74,7 @@ def startTest(testName, DEVICE, params):
#initialise plot tab with 2 plots
scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] )
#set plot name(tab title)
scan.setPlotName(plotName + " Manual Scan")
scan.setPlotTitle(plotName + " Manual Scan")
#start plots. See further below how to add points to the plots
scan.start()
@@ -9,7 +9,7 @@ def startTest(testName, DEVICE, params):
#by default, assume the test failed
ret = 'Test failed'
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
#plot name to be given to the scan. Use: scan.setPlotTitle(plotName)
plotName = DEVICE + ' - ' + testName
#put the whole custom code under try/catch
try:
@@ -74,7 +74,7 @@ def startTest(testName, DEVICE, params):
#initialise plot tab with 2 plots
scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] )
#set plot name(tab title)
scan.setPlotName(plotName + "Manual Scan")
scan.setPlotTitle(plotName + "Manual Scan")
#start plots. See further below how to add points to the plots
scan.start()
@@ -2,18 +2,6 @@
#test that does not use any connection to IOC. It is useful to test pure pshell graphical features.
# testing environment setup (if script is launched directly without Testinglist)
is_panel = get_exec_pars().source != CommandSource.ui
test = ""
device = ""
parameters = ""
if not is_panel:
# set up params for testing
test = "test without ioc"
device = "no-device"
parameters = "{'howManySamples': {'description': 'How many samples are plotted', 'value': '50'}, 'delayBetweenSampleS': {'description': 'delay [s] between two samples', 'value': '0.05'}, 'repeatTimes': {'description': 'how many times the test is repeated', 'value': '3'}}"
pass
###### Init - DO NOT MODIFY THE CODE BELOW ######
global sys, inspect, os, traceback
import sys, inspect, os, traceback
@@ -156,12 +144,24 @@ def startTest(testName, DEVICE, params):
test.sendFeedback(ret, success)
except:
#generic error handler
import traceback
ret = traceback.format_exc()
success = False
test.sendFeedback(ret, success)
#launch the test
startTest(test, device, parameters)
# testing environment setup (if script is launched directly without Testinglist)
is_panel = get_exec_pars().source != CommandSource.ui
if not is_panel:
#launch the test with default input
test = "test without ioc"
device = "no-device"
import json
parameters = json.loads('{"howManySamples": {"description": "How many samples are plotted", "value": "50"}, "delayBetweenSampleS": {"description": "delay [s] between two samples", "value": "0.05"}, "repeatTimes": {"description": "how many times the test is repeated", "value": "3"}}')
startTest(test, device, parameters)
#pass
else:
#launch the test with input from tsting list
startTest(test, device, parameters)
################ END OF Final ####################
#### IF NEEDED, ADD YOUR FUNCTIONS HERE BELOW ####