Skip to content

Instantly share code, notes, and snippets.

View oiuww09fn's full-sized avatar

bob oiuww09fn

View GitHub Profile
# -*- coding: utf-8 -*-
# export the book Learn Vimscript the Hard Way
# git clone https://github.com/sjl/learnvimscriptthehardway.git
# copy the file in learnvimscriptthehardway folder.
import os
ROOTPATH = os.path.dirname(__file__)
@oiuww09fn
oiuww09fn / chrome.py
Created December 7, 2013 13:43
Selenium with python for chrome safari and opera.
import time
from selenium import webdriver
a = webdriver.chrome.options.Options()
a.binary_location = None
driver = webdriver.Chrome() # Optional argument, if not specified will search path.
driver.get('http://www.google.com/xhtml')
time.sleep(5) # Let the user actually see something!
search_box = driver.find_element_by_name('q')
search_box.send_keys('ChromeDriver')
@oiuww09fn
oiuww09fn / python_class.md
Created December 7, 2013 13:49
python class
  • When you access an attribute, the resulting value may come from several different places. For example, a.name in the previous example returns the name attribute of the instance a. However, a.deposit returns the deposit attribute (a method) of the Account class.When you access an attribute, the instance is checked first and if nothing is known, the search moves to the instance’s class instead.This is the underlying mechanism by which a class shares its attributes with all of its instances.
  • **The lack of scoping in classes is one area where Python differs from C++ or Java. If you have used those languages, the self parameter in Python is the same as the this pointer. The explicit use of self is required because Python does not provide a means to explicitly declare variables (that is, a declaration such as int x or float y in C). Without this, there is no way to know whether an assignment to a variable in a method is supposed to be a local variable or if it’s supposed to be saved as an instance attribut
@oiuww09fn
oiuww09fn / hello.txt
Last active January 3, 2016 16:19
Robot Framework output.xml
*** Test Cases ***
Hello haha
Log hello
@oiuww09fn
oiuww09fn / rf_for.txt
Last active January 3, 2016 20:09
Robot Framework Test Data Demo
*** Keywords ***
a simple for loop
[documentation] just a for loop test
# in range
:for ${i} in range 10
\ run keyword if ${i} == 6 exit for loop
\ log ${i}
创建测试文件
1 测试文件语法
1.1 测试用例文件和目录的组织层次结构:
测试用例在测试用例文件中创建;一个测试用例文件自动的创建一个包含文件中所有测试用例的测试集;一个包含测试用例文件的目录构成一个更高级的测试集,这个测试集(目录)包含每一个测试用例文件形成的子测试集;测试集目录可以包含子测试集目录,子测试集目录又可以包含孙子测试集目录,只有需要,可以嵌套多层;测试集目录可以有一个特殊的初始化文件(__init__.txt,类似于python)。
此外:测试库包含最低级的关键字;资源文件包含变量和更高级的用户自定义关键字;变量文件提供比资源文件更灵活的定义变量的形式。
1.2 支持文件格式:
Robot Framework的测试数据被定义为表格形式,支持HTML\TSV\reST\Txt(从2.7.6开始,txt文件后缀名可以为.robot,方便与普通txt文件区分)。Robot Framework根据文件后缀判断文件类型,进行解析。后缀名不区分大小写。
@oiuww09fn
oiuww09fn / create_test_data.md
Created March 4, 2014 10:25
Robot Framework documentation

创建测试文件

1 测试文件语法

1.1 测试用例文件和目录的组织层次结构

  • 测试用例在测试用例文件中创建;
  • 一个测试用例文件自动的创建一个包含文件中所有测试用例的测试集;
@oiuww09fn
oiuww09fn / package.py
Created March 14, 2014 06:10
robotframework + cdemo
#!/usr/bin/env python
from glob import glob
from os import chdir, sep as SEP
from os.path import abspath, dirname, join
from time import localtime
from zipfile import ZipFile, ZIP_DEFLATED
NAME = 'robotframework-c-example'
ZIP_NAME = NAME + '-%d%02d%02d.zip' % localtime()[:3]
@oiuww09fn
oiuww09fn / bashrc
Last active August 29, 2015 13:57
bashrc
# TODO Anywhere
export SVN_EDITOR=vim
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias ......='cd ../../../../..'
alias autopep8='autopep8 --in-place --aggressive'
alias du='du -sh'
#!/usr/bin/python
import random
def randomMAC():
mac = [ 0x52, 0x54, 0x00,
random.randint(0x00, 0x7f),