-
Notifications
You must be signed in to change notification settings - Fork 1
/
exampleButtonTest.m
37 lines (28 loc) · 1.45 KB
/
exampleButtonTest.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
classdef exampleButtonTest < matlab.unittest.TestCase & matlab.mock.TestCase & matlab.uitest.TestCase
%% Methods - Test
methods (Test)
% Scenario: The Tool shall allow the user to abort the execution
function testAbortWorkflow(testCase)
app = exampleButtonTestingApp;
%TODO - Figure out a way to make this asynchronous.
% I have tried using testCase.press(location) rather than the button instance. That also did not work
testCase.press(app.StartButton);
testCase.verifyEqual(app.mainClass.state, 'Running');
pause(3);
testCase.press(app.AbortButton);
testCase.verifyEqual(app.mainClass.state, 'Aborted');
delete(app);
end % testAbortWorkflow
function testAbortWorkflowPressLocation(testCase)
app = exampleButtonTestingApp;
% I have tried using testCase.press(location) rather than the button instance. That also did not work
pos = app.StartButton.Position;
testCase.press(app.UIFigure, [pos(1)+20, pos(2)+20]);
testCase.verifyEqual(app.mainClass.state, 'Running');
pause(3);
testCase.press(app.AbortButton);
testCase.verifyEqual(app.mainClass.state, 'Aborted');
delete(app);
end % testAbortWorkflow
end %methods (Test)
end %classdef