使用ExtJS 6进行功能测试 [英] Functional Test With ExtJS 6

查看:83
本文介绍了使用ExtJS 6进行功能测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用HP UFT进行功能测试.

I'm using HP UFT for functional tests.

由于ExtJS的动态ID定义,我无法使用UFT记录功能.

Because of dynamic id definition of ExtJS, I can't use UFT Recording feature.

我尝试了多种方式为静态分配动态ID.

I've tried many ways for assigning dynamic IDs to staticly.

I tried to change id: function() in ext-all-debug.js file.
I tried to change Components getId() function in ext-all-debug.js file.
I tried override components with afterRender method to change ids aswell.

有时候我可以通过使用组件的属性(文本,fieldLabel,overflowText等)来更改id,但是对于某些组件,由于组件的属性似乎为空,我无法实现分配ID的目的.

Sometimes I achieved to change id's using component's properties (text, fieldLabel, overflowText, etc.), but for some components I couldn't achieve to assign ID's since the components properties seem empty.

上面,我列出了分配静态ID的操作.因此,我想知道您对我的操作的看法,如果您发现它们不正确或不充分,可以为我提供将HP UFT记录功能与ExtJS6一起使用的新方法.

Above, I listed my actions to assign static ID. So, I want to know your opinions about my actions and if you found them incorrect or not sufficient, could you offer me new approaches for using HP UFT recording feature with ExtJS6.

推荐答案

您不能更改表示ExtJS组件的dom元素的动态id.那真的是一件坏事,我想您会破坏整个应用程序的.

You can't change the dynamic id of the dom elements which represents ExtJS components. That's really bad thing and I think you would break the whole app.

测试ExtJS应用最简单的方法是使用已创建的框架/工具,例如:

The easiest way to test ExtJS app is to use already created frameworks/tools like:













Sencha测试,由Sencha

Siesta by Bryntum
Sencha Test by Sencha

午睡是免费的.它具有一些需要许可证的专业功能.但是您可以免费使用它.

The Siesta is free. It has some pro features which requires the license. But you can use it for free.

如果您仍然坚持按照自己的方式做. 您需要动态获取由ExtJS组件创建的dom元素的ID .基本上编写您自己的API.
您需要执行ExtJS JS代码,这将返回您组件的ID.因此,您需要获取ExtJS组件并调用 getId() 函数可以获取dom ID.

If you still insists on doing it your way. You need to dynamically get the IDs of the dom elements created by ExtJS components. Basically write your own API.
You need to execute the ExtJS JS code, which will return you the ID of the component. So you need to get the ExtJS component and call getId() function on it to get the dom id.

这是示例代码:

>Ext.ComponentQuery.query('checkbox')[0].getId()
"checkbox-1047"

您将完全需要: http: //docs.sencha.com/extjs/6.5.3/modern/Ext.ComponentQuery.html#method-query 并且请记住,查询可以非常高级,您可以使用在ExtJS元素(例如名称,xtype等)上设置的所有配置

You will definetely need: http://docs.sencha.com/extjs/6.5.3/modern/Ext.ComponentQuery.html#method-query And keep in mind that the query can be pretty advanced and you can use all the configs which are set on the ExtJS elements such as name, xtype, etc

您可以在我的其他助手中找到其他信息 https://stackoverflow.com/a/41718879/1768843

You can find some other info in my other anwser https://stackoverflow.com/a/41718879/1768843

这篇关于使用ExtJS 6进行功能测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆