-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTestPatientsDisplay.m
59 lines (47 loc) · 2.11 KB
/
TestPatientsDisplay.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
classdef TestPatientsDisplay < matlab.uitest.TestCase
properties
App
end
methods (TestMethodSetup)
function launchApp(testCase)
testCase.App = PatientsDisplay;
testCase.addTeardown(@delete,testCase.App);
end
end
methods (Test)
function test_bloodPressure(testCase)
% Extract blood pressure data from app
t = testCase.App.DataTab.Children.Data;
t.Gender = categorical(t.Gender);
allMales = t(t.Gender == 'Male',:);
maleDiastolicData = allMales.Diastolic';
maleSystolicData = allMales.Systolic';
% Verify ylabel and that male Systolic data shows
ax = testCase.App.UIAxes;
testCase.verifyEqual(ax.YLabel.String,'Systolic')
testCase.verifyEqual(ax.Children.YData,maleSystolicData)
% Switch to 'Diastolic' reading
testCase.choose(testCase.App.BloodPressureSwitch,'Diastolic')
% Verify ylabel changed and male Diastolic data shows
testCase.verifyEqual(ax.YLabel.String,'Diastolic')
testCase.verifyEqual(ax.Children.YData,maleDiastolicData);
end
function test_plottingOptions(testCase)
% Press the histogram radio button
testCase.press(testCase.App.HistogramButton)
% Verify xlabel updated from 'Weight' to 'Systolic'
testCase.verifyEqual(testCase.App.UIAxes.XLabel.String,'Systolic')
% Change the Bin Width to 9
testCase.choose(testCase.App.BinWidthSlider,9)
% Verify the number of bins is now 4
testCase.verifyEqual(testCase.App.UIAxes.Children.NumBins,4)
end
function test_tab(testCase)
% Choose Data Tab
dataTab = testCase.App.DataTab;
testCase.choose(dataTab)
% Verify Data Tab is selected
testCase.verifyEqual(testCase.App.TabGroup.SelectedTab.Title,'Data')
end
end
end