test uitable cell edit event with App Testing Framework

조회 수: 4 (최근 30일)
Bence Molnar
Bence Molnar 2020년 10월 5일
댓글: Michaela Konstantinou 2021년 9월 9일
I have an editable table in my App with callback upon field change (CellEditCallback).
What is the way to test cell editing with App Testing Framework? Documentation does not mention anything about tables: https://www.mathworks.com/help/matlab/matlab_prog/overview-of-app-testing-framework.html
  댓글 수: 1
Michaela Konstantinou
Michaela Konstantinou 2021년 9월 9일
check the type gesture (https://ch.mathworks.com/help//matlab/ref/matlab.uitest.testcase.type.html). Tha case of type(testcase,uit,indices,value) types value in the cell specified by indices within the table UI component uit.
e.g
testCase.type(testTable, [16 2], 'Michaela');
Unrecognized function or variable 'testTable'.
then you can check the value by
testCase.verifyEqual(testTable.data{16,2}, whatever)

댓글을 달려면 로그인하십시오.

답변 (1개)

Monika Phadnis
Monika Phadnis 2020년 10월 9일
You can edit values in the table by editing the 'Data' property of 'uitable'.
Assuming, we have app with a single UI element - the 'uitable', you can write function similar to the following in your test class:
function testUItable(test)
appObject = app1(); % create an app object and open the app
appObject.UITable.Data{1,1} = {'xyz'}; % edit 1,1 value in UITable
appObject.UITable.Data{2,2} = {'abc'}; % edit 2,2 value in UITable
% add verifying function calls here
end
You can edit the Data property as editing any cell array.
Hope this helps.
  댓글 수: 1
Bence Molnar
Bence Molnar 2020년 10월 11일
I would like to test the user interface with App Testing Framework. The main goal is to test the functionality of User Interface, so testing events, callbacks etc...
With suggested method I was unable to trigger CellEditCallback function. Do you have any idea to trigger this callback from App Testing Framework?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by