unit.TestCase

TestCase

package haxe-unit

Available on all platforms

This unit test class should be extended to create test cases. Each test method created in this extended class should start with the name "test".

These test methods should call the assertion methods:

  • assertTrue(a): Succeeds if a is true.
  • assertFalse(a): Succeeds if a is false.
  • assertEquals(expected, actual): Succeeds if expected and actual are equal.
class MyTestCase extends haxe.unit.TestCase {
	function testBasic() {
		assertEquals("A", "A");
	}
}

The TestCase can be tested using TestRunner.

To run code before or after the test, override the functions setup and tearDown.

See:

Constructor

new ()

Variables

currentTest:TestStatus

The current test status of the TestRunner.

Methods

assertEquals<T> (expected:T, actual:T, ?c:PosInfos):Void

Succeeds if expected and actual are equal.

assertFalse (b:Bool, ?c:PosInfos):Void

Succeeds if b is false.

assertTrue (b:Bool, ?c:PosInfos):Void

Succeeds if b is true.

print (v:Dynamic):Void

setup ():Void

Override this method to execute code before the test runs.

tearDown ():Void

Override this method to execute code after the test ran.

© 2005–2016 Haxe Foundation
Licensed under a MIT license.
http://api.haxe.org/haxe/unit/TestCase.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部