How can I include the "blue dot" when taking pictures of an app for a test report.

1 view (last 30 days)
David Szwer
David Szwer on 16 Nov 2021
Commented: Richard Quist on 26 Feb 2022
The App Testing Framework allows Matlab to "press" GUI buttons to test that they have the right effect, and it provides a helpful blue dot so that you can see where the virtual mouse clicks occur, while it happens. It would be handy if I could take pictures of this behaviour and log them in the error report, as an additional check that pressing the "Plot" button causes a graph to appear. Unfortunately, I know two methods that almost do this, but not quite. Both these are used with testCase.log() or similar constructions.
  1. Using the FigureDiagnostic class (e.g. FigureDiagnostic(app.UIFigure, Formats = "png") ) correctly takes a picture of the app, but it does not include the blue dot. This makes it a bit harder to see at a glance what the test was attempting to do.
  2. Using the ScreenshotDiagnostic class does include the blue dot in its image (see clipping above), but the screenshot includes the entire screen (including all monitors), not just the app. It would be inconvenient to turn off my extra monitors every time I run tests.
Is there a way to combine the advantage of both these methods, please?
I have thought of expanding the gesture functions ( testCase.press(app.Switch_1) etc.) to also change the colour of the control (although switches don't have a changeable colour); or to superimpose a label object with a symbol indicating the interaction. But they may come with all sorts of problems of their own, and I hope there is an easier way.
  1 Comment
Richard Quist
Richard Quist on 26 Feb 2022
I don't know if this will work any better than FigureDiagnostic, but you can try using the exportapp function if you have R2020b or later.
HTH

Sign in to comment.

Answers (0)

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by