现在的位置: 首页 > 综合 > 正文

IBM网站上的一点内容(暂时设为私有)

2018年04月30日 ⁄ 综合 ⁄ 共 2007字 ⁄ 字号 评论关闭

There are several ways of doing what you are looking to do. Below are a few things you can look into and see if they will work for what you are wanting to do.

1) Use regular expressions - Depending on what properties are different, you can modify the expected values using regular expressions so that RFT will accept multiple inputs for that property. For example, say you have a button and in one UI it says "Click" and in another it says "Click Me!". You could change the corresponding expected value in the object map to a regular expression that matches both values. This will generally work well in situations where the differences between objects is small.

2) Use the dynamic find - If your problem lies in the property types themselves, i.e. having scripts for both java and web UIs, or the differences in your objects are too complex, i.e. testing against different languages, you can use the dynamic find method to get your objects. This route can be very easy to maintain, but requires a good amount of set up time get the properties you want to use and code them into your script or into a separate file that your script reads from. Using this method you could have your script call a factory class to perform the appropriate action depending on what UI you are testing.

3) Use the RFT script helper templates - You can also modify your script helper templates to make the object methods create by RFT public instead of protected. By doing this you can set up your project so that you have "map" scripts which contain the objects you need, and then controller classes that get an object from a map based on the UI you are testing.

 

I'd advise against options 1 and 3:

Option 1 requires too much manual tweaking of object maps.

Option 3 is close to a good solution, but I don't understand why you suggest making the object-access methods in the helpers public. I think he would want the objects to have the same name in each UI's object map... making the object retrieval methods in the helpers public would presumably prevent this. Also, if you have 'map' scripts, why do the objects need to be public in the first place? Only the scripts containing the object map need access to the objects in the map, and then the methods in those scripts for accessing the objects could be public. He had actually come very close to suggesting this solution himself, since he mentioned that he is already wrapping object retrieval in script calls.

抱歉!评论已关闭.