jQuery火箭图标返回顶部代码

之前对robotframework-ride了解的不多,后来知道了引入Selenium2Lirary库后可以做web UI自动化测试,但发现和python没啥关系,今天学习了封装系统关键字算是和python联系上了,跟封装包提供调用函数类似。
1.封装一个库并调试通过、放在C:Python27Libsite-packages目录下
2.ride中导入Library
3.查看导入的库
4.测试库是否正常工作
 
1.创建一个目录HelloWorld(这是库的名字,自己随便定义)
2.在目录中创建两个文件__init__.py,和helloworld.py,把helloworld.py调通,保证能够运行无语法错误。
helloworld.py文件内容,复制代码要小心,并一定调试通过再往下走。
# -*- coding:utf-8 -*-
'''
    created by captain9 2017-1-2
'''

__version__ = '0.1'


class Hello(object):
    def hi(self,name):
        u'''接收一个名字,并问候.例如
        | hi  | xiaoming        | 
        '''
        print 'Hello, ' + name + '!'

    def decode(self,name):
        return customerstr.decode('utf-8')

if __name__ == "__main__":
    name = u'xiaodong'
    run = Hello()
    run.hi(name)
View Code

__init__.py文件内容

# -*- coding:utf-8 -*-
#  Copyright (c) 2010 Franz Allan Valencia See
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.

from helloworld import Hello

__version__ = '0.1'


class HelloWorld(Hello):
    """
    这是一个HelloWorld库,输入名字,输出问候。
 
    """
    ROBOT_LIBRARY_SCOPE = 'GLOBAL'
View Code

2.把HelloWorld目录放到C:Python27Libsite-packages目录下

2.ride中导入Library,注意大小写敏感,这里是文件夹的名称:
若为黑色则为导入成功,红色为失败,helloword.py文件能否正常运行。
3.查看导入的库 F5或者Tools-Search Keywords
4.测试库是否正常工作
虽然关键字大小写不敏感,但我认为还是按照大小写敏感来写比较规范。
测试结果
 
好了,以后可以开发更多有用的关键字了。
 
Robot Framework is a Python-based, extensible keyword-driven test automation framework for end-to-end acceptance testing and acceptance-test-driven development (ATDD). It can be used for testing distributed, heterogeneous applications, where verification requires touching several technologies and interfaces.
 
参考:
Robot Framework自动化测试(五)--- 开发系统关键字 - 虫师 - 博客园
原文地址:https://www.cnblogs.com/v5captain/p/6242743.html