[英]Test Framework for native mobile apps (iOS/Android) with OpenGL and Embedded Webviews
I have a cross platform mobile application that is: 我有一个跨平台的移动应用程序,它是:
Finding a proper test framework has been challenging. 寻找合适的测试框架一直是一项挑战。
We can test a lot with the C++ Google Test Framework. 我们可以使用C ++ Google Test Framework进行很多测试。 Nevertheless, we want to do end-to-end tests (like Selenium) that drags/double taps around the OpenGL view as well as the Webview.
尽管如此,我们还是希望进行端到端测试(例如Selenium),以便在OpenGL视图和Web视图周围拖动/双击。
I have looked at Appium and Selenium which can test everything except the OpenGL interface (which fires of the WebvViews) but I cannot find any examples for OpenGL tests. 我已经看过Appium和Selenium,它们可以测试除OpenGL接口(WebvViews触发)之外的所有内容,但是我找不到用于OpenGL测试的任何示例。
Is there a good framework for testing OpenGL apps? 有没有测试OpenGL应用程序的好框架?
I have written unit-tests for C++ (Qt on Linux) & OpenGL before. 我之前已经编写了C ++(在Linux上为Qt)和OpenGL的单元测试。 I don't know any reason it shouldn't work for Java too.
我不知道它也不适合Java的任何原因。
The things which worked for me are: 对我有用的是:
Abstract your OpenGL context provider so the rest of your code is independent of it. 抽象您的OpenGL上下文提供程序,以便其余代码独立于它。 In my case the main app used Qt's QGLWidget, but the unittests used a pbuffer-based one which I could create with no windowing infrastructure at all (other than a designated X11 DISPLAY).
在我的情况下,主应用程序使用了Qt的QGLWidget,但是单元测试使用了一个基于pbuffer的程序,我完全可以创建它而没有窗口基础结构(指定的X11 DISPLAY除外)。 Later I added an "offscreen Mesa" (pure software OpenGL implementation) so they'd even work on a headless build machine with no GPU at all.
后来我添加了“屏幕外Mesa”(纯软件OpenGL实现),因此它们甚至可以在完全没有GPU的无头构建机器上工作。
Keep your OpenGL code independent of your GUI code. 保持OpenGL代码独立于GUI代码。 In my case the OpenGL "rendering engine" didn't know anything about Qt classes (eg mouse events).
以我为例,OpenGL“渲染引擎”对Qt类一无所知(例如鼠标事件)。 Define your own testable API which isn't tied to any specific GUI concepts, and write tests for it.
定义您自己的可测试API,该API与任何特定的GUI概念无关,并为此编写测试。
In the unittests, read the contents back from the framebuffer using glReadPixels and either hit them with some assertions about which pixels should be particular values, or go down the regression-testing route and compare the framebuffer capture with a stored image you know is good (either from manual verification, or because it's produced from some other reference model). 在单元测试中,使用glReadPixels从帧缓冲区中读取内容,并通过断言确定哪些像素应为特定值,或者沿着回归测试路线进行比较,然后将帧缓冲区捕获与已知的存储图像进行比较(要么是通过人工验证,要么是因为它是由其他参考模型产生的)。
Allow a bit of fuzziness in any image regression testing; 在任何图像回归测试中都应允许一些模糊性; most OpenGL implementations produce slightly different output.
大多数OpenGL实现产生的输出略有不同。
(I didn't do this, but...) Ideally you want to be able to test the GUI layer by asserting that it makes the expected sequence of calls to your rendering engine in response to GUI activity. (我没有这样做,但是...)理想情况下,您希望能够通过断言它响应GUI活动对渲染引擎进行了预期的调用顺序来测试GUI层。 If it does that, and you're confident of your render layer because of the above tests... well, no need to actually do the rendering.
如果这样做,并且由于上述测试,您对自己的渲染层很有信心...那么,实际上就不需要进行渲染。 So create a suitable mock object of your rendering layer for use when GUI testing (I'd imagine tests like "mouse drag from here to there results in a call to the rendering layer to set a particular transform matrix"... stuff like that).
因此,请为您的渲染层创建一个合适的模拟对象,以便在GUI测试时使用(我想像“鼠标从此处拖动到那里会导致调用渲染层以设置特定的变换矩阵”之类的测试……类似的东西)。
Hope it helps! 希望能帮助到你! I found it on.. ref.
我发现它了。 Automated testing for OpenGL application
OpenGL应用程序的自动化测试
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.