Skip to content

Commit c2efa05

Browse files
committed
Improve test cases without hardware.
1 parent 206dd42 commit c2efa05

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

tests/basicTests.m

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
11
classdef basicTests < matlab.unittest.TestCase
22

3-
properties
4-
bd bossdevice
5-
sgPath
6-
isSGinstalled
3+
properties (Constant)
4+
bd = bossdevice
75
end
86

9-
methods (Test, TestTags = {'noHW'})
10-
% Test methods that do not require bossdevice or any target connected
11-
function noBossdevice(testCase)
12-
testCase.bd = bossdevice;
7+
methods (TestClassSetup)
8+
function disconnectBossdevice(testCase)
139
if testCase.bd.isConnected
1410
testCase.bd.delete;
1511
end
12+
end
13+
end
14+
15+
methods (Test, TestTags = {'noHW'})
16+
% Test methods that do not require bossdevice or any target connected
17+
function noBossdevice(testCase)
1618
testCase.verifyFalse(testCase.bd.isConnected);
1719
end
20+
21+
function initializeError(testCase)
22+
testCase.verifyError(@() testCase.bd.manualTrigger, 'bossdeviceapi:appNotRunning');
23+
end
24+
25+
function startRecordingError(testCase)
26+
testCase.verifyError(@() testCase.bd.startRecording, 'slrealtime:target:notConnectedError');
27+
end
1828
end
1929

2030
end

toolbox/src/bossdevice.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ function initOscillationProps(obj)
177177
obj.selectFirmware;
178178
obj.logObj.info('Please run installFirmwareOnToolbox to permanently copy the firmware file into the toolbox and skip this step.');
179179
else
180-
obj.logObj.error('bossapi:noMLDATX',[obj.appName,'.mldatx could not be found in the MATLAB path.']);
180+
obj.logObj.error([obj.appName,'.mldatx could not be found in the MATLAB path.'],'bossdeviceapi:noMLDATX');
181181
end
182182

183183
% Initialize bossdevice if it is connected
@@ -251,7 +251,7 @@ function initialize(obj)
251251
% Use SFTP always avoiding potential issues with active UDP traffic on secondary Ethernet port (QNX issue)
252252
obj.targetObject.UseSFTP = 1;
253253

254-
% Connect to bosdevice
254+
% Connect to bossdevice
255255
obj.targetObject.connect;
256256

257257
% Load firmware on the bossdevice if not loaded yet
@@ -540,7 +540,7 @@ function manualTrigger(obj)
540540

541541
else
542542
obj.logObj.error({'Target "%s" is not running yet. Start it before sending a trigger.',...
543-
obj.targetObject.TargetSettings.name});
543+
obj.targetObject.TargetSettings.name},'bossdeviceapi:appNotRunning');
544544
end
545545

546546
function cleanupManualTrigger(obj)

0 commit comments

Comments
 (0)