`

Flash Builder 4 Beta和FlexUnit下的测试驱动开发---断言方法

    博客分类:
  • Flex
阅读更多

Flash Builder 4 Beta和FlexUnit下的测试驱动开发---断言方法

 

Assertion method

Meanings

assertEquals

Asserts that two values are equal.

assertContained

Asserts that the first string is contained in the second one.

assertNotContained

Asserts that the first string is not contained in the second one.

assertFalse

Asserts that a condition is false.

assertTrue

Asserts that a condition is true.

assertMatch

Asserts that a string matches a regular expression (regexp).

assertNoMatch

Asserts that a string doesn't match a regexp.

assertNull

Asserts that an object is null.

assertNotNull

Asserts that an object is not null.

assertNotUndefined

Asserts that an object is defined.

assertUndefined

Asserts that an object is undefined.

assertStrictlyEquals

Asserts that two objects are strictly identical.

assertObjectEquals

Asserts that two objects are equal.

转载:http://www.adobe.com/cn/devnet/flex/articles/flashbuilder4_tdd_04.html

 

断言方法要求三个参数:一个包括字符串信息,另两个参数参与比较。字符串参数包含了测试失败时的描述信息。例如:

assertEquals("Error testing the application state", state, 1);

如果不传入该消息参数,FlexUnit将使用缺省信息。

在编辑器中键入Assert. 你可以通过代码提示功能看到可以使用的全部断言方法。

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics