I got 'Invalid or deleted object.' from app designer.
Show older comments
I am trying to create a app Test Class with app test framework.
I wrote below code,
classdef TestModelVerificationApp < matlab.uitest.TestCase
properties
App
end
methods (TestClassSetup)
% Shared setup for the entire test class
end
methods (TestMethodSetup)
% Setup for each test
function launchApp(testCase)
testCase.App = ModelVerificationApp;
testCase.addTeardown(@delete,testCase.App);
end
end
methods (Test)
% Test methods
function test_bttn_select(testCase)
% Click Button_Select Button
testCase.press(testCase.App.Button_Run)
% Verify selected model has been updated
testCase.verifyEqual(testCase.App.ListBox_SelectedModels.Items,'test item')
end
function unimplementedTest(testCase)
testCase.verifyFail("Unimplemented test");
end
end
end
for test below app. Below is a beginning part of the app, 'ModelVerificationApp'
classdef ModelVerificationApp < matlab.apps.AppBase
properties (Access = public)
ModelAdvisorAppUIFigure matlab.ui.Figure
ModelAdvisorPanel matlab.ui.container.Panel
Button_Run matlab.ui.control.Button
And, when I try to test this, I got below error message.
================================================================================
Error occurred in ModelVerificationApp/test_bttn_select and it did not run to completion.
---------
Error ID:
---------
'MATLAB:class:InvalidHandle'
--------------
Error Details:
--------------
Invalid or deleted object.
Error in TestModelVerificationApp/test_bttn_select (line 24)
testCase.press(testCase.App.Button_Run)
================================================================================
Anyone can tell me why?
Thanks.
Accepted Answer
More Answers (0)
Categories
Find more on Develop Apps Using App Designer in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!