移动API测试

1. Post、get参数到相应URL

2. 测试步骤:
 a)编写API调用程序
 b)模拟输入参数
 c)检查结果输出

3. 测试技能要求:
 a)懂php,能写API调用程序
 b)懂json,能分析结果输出
 c)熟悉app应用功能,涉及到数据存取部分,能了解具体流程及网站上对应的功能

4. 数据准备:
 a)正向用例:符合业务逻辑的数据
 b)特殊字符,如:<、>、&、=、%、空格等。重点是&、=、空格,这些字符在post、get请求中是关键字,如果没有进行转义,就会报错
 c)空参数。如果参数为必选,不传该参数,会有何结果
 d)参数类型错误。如需要输入整形,实际输入字符型,会有何结果
 e)字符串长度超长,会有何结果
 f)用户可输入的参数,是否能SQL注入

5. 结果检查
 a)输出结果是否符合逻辑。原本正确的操作,是否返回true。原本异常的操作,是否能显示正确的错误提示。
 b)输出结果json格式是否正确
 c)输出结果是否含有warning、error、echo等非json格式字符串
 d)输出结果字段值是否正确,与网站上的值是否匹配。

6. API测试能做哪些方面的测试
 a)功能测试,测试API功能是否正确
 b)冒烟测试,开发在新版API上线前,进行大规模API冒烟测试,检查API是否正常
 c)数据测试,手工检查大规模的数据比较耗时耗力。通过程序自动检查大量数据情况下的API返回值,记录在某些组合下的异常数据。

css selectors

用于selenium中控件定位。杯具的xpath在ie下识别很慢,换用css定位吧。
http://www.w3.org/TR/css3-selectors/

Pattern Meaning Described in section First defined in CSS level
* any element Universal selector 2
E an element of type E Type selector 1
E[foo] an E element with a “foo” attribute Attribute selectors 2
E[foo=”bar”] an E element whose “foo” attribute value is exactly equal to “bar” Attribute selectors 2
E[foo~=”bar”] an E element whose “foo” attribute value is a list of whitespace-separated values, one of which is exactly equal to “bar” Attribute selectors 2
E[foo^=”bar”] an E element whose “foo” attribute value begins exactly with the string “bar” Attribute selectors 3
E[foo$=”bar”] an E element whose “foo” attribute value ends exactly with the string “bar” Attribute selectors 3
E[foo*=”bar”] an E element whose “foo” attribute value contains the substring “bar” Attribute selectors 3
E[foo|=”en”] an E element whose “foo” attribute has a hyphen-separated list of values beginning (from the left) with “en” Attribute selectors 2
E:root an E element, root of the document Structural pseudo-classes 3
E:nth-child(n) an E element, the n-th child of its parent Structural pseudo-classes 3
E:nth-last-child(n) an E element, the n-th child of its parent, counting from the last one Structural pseudo-classes 3
E:nth-of-type(n) an E element, the n-th sibling of its type Structural pseudo-classes 3
E:nth-last-of-type(n) an E element, the n-th sibling of its type, counting from the last one Structural pseudo-classes 3
E:first-child an E element, first child of its parent Structural pseudo-classes 2
E:last-child an E element, last child of its parent Structural pseudo-classes 3
E:first-of-type an E element, first sibling of its type Structural pseudo-classes 3
E:last-of-type an E element, last sibling of its type Structural pseudo-classes 3
E:only-child an E element, only child of its parent Structural pseudo-classes 3
E:only-of-type an E element, only sibling of its type Structural pseudo-classes 3
E:empty an E element that has no children (including text nodes) Structural pseudo-classes 3
E:link
E:visited
an E element being the source anchor of a hyperlink of which the target is not yet visited (:link) or already visited (:visited) The link pseudo-classes 1
E:active
E:hover
E:focus
an E element during certain user actions The user action pseudo-classes 1 and 2
E:target an E element being the target of the referring URI The target pseudo-class 3
E:lang(fr) an element of type E in language “fr” (the document language specifies how language is determined) The :lang() pseudo-class 2
E:enabled
E:disabled
a user interface element E which is enabled or disabled The UI element states pseudo-classes 3
E:checked a user interface element E which is checked (for instance a radio-button or checkbox) The UI element states pseudo-classes 3
E::first-line the first formatted line of an E element The ::first-line pseudo-element 1
E::first-letter the first formatted letter of an E element The ::first-letter pseudo-element 1
E::before generated content before an E element The ::before pseudo-element 2
E::after generated content after an E element The ::after pseudo-element 2
E.warning an E element whose class is “warning” (the document language specifies how class is determined). Class selectors 1
E#myid an E element with ID equal to “myid”. ID selectors 1
E:not(s) an E element that does not match simple selector s Negation pseudo-class 3
E F an F element descendant of an E element Descendant combinator 1
E > F an F element child of an E element Child combinator 2
E + F an F element immediately preceded by an E element Adjacent sibling combinator 2
E ~ F an F element preceded by an E element General sibling combinator 3