vdelachaux / unit-tests-with-Classes

A way to manage unit tests with 4D

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

language language code-size license

unit-tests-with-Classes

The purpose of this class is to allow implementing unit tests in 4D with a minimum of code.
This class will be augmented according to my needs but I strongly encouraged you to enrich this project through pull request. This can only benefit the 4D developer community

See the documentation (also available via the Explorer's documentation panel) or the method test_ut_class to learn how to use it.

Enjoy the 4th dimension

Code sample

var $ut : cs.ut
$ut:=cs.ut.new()

$ut.suite("First Suite")
$ut.test("Integer formula").expect(1+1).isEqualTo(Formula(1*2))
If ($ut.success)	
   $ut.test("Text strict").expect("Hello World").strict().isEqualTo("Hello World")
   $ut.test("Not strictly equal object").expect(New object("foo"; "bar")).strict().isNotEqual(New object("foo"; "BAR"))
   $ut.test("Boolean").expect(True).noAssert().isEqualTo(False)
   ASSERT(Not($ut.successfull))
   ASSERT($ut.lastErrorText="First Suite: 'Boolean' gives 'False' when 'True' was expected")
End if 

More sample code into the class documentation & the test_ut_class method

About

A way to manage unit tests with 4D

License:MIT License


Languages

Language:4D 100.0%