siliziumbrain.unittestprovider: | Types | Modinfo | Source |
TTestFailException | An exception for tests. |
TUnitTestProvider | Unit Test Provider class. |
Type TTestFailException Extends TException | |
Description | An exception for tests. |
Information | This exception is thrown everytime a test fails. |
Methods Summary | |
---|---|
Copy | Copies the exception. |
NewException | Constructor for the exception. |
Functions Summary | |
---|---|
__NextID | Private method. Do not use. |
Method Copy:TTestFailException() | |
Description | Copies the exception. |
Information | Creates a deep copy of the exception. returns: A deep copy of the exception. |
Method NewException:TTestFailException(psGivenMessage:String) | |
Description | Constructor for the exception. |
Information | Sets the extern message to psGivenMessage. Can be used like that: Throw new TNullPointerException.NewException. |
Function __NextID:Int() | |
Description | Private method. Do not use. |
Information | Returns the next ID for a new exception. |
Type TUnitTestProvider | |
Description | Unit Test Provider class. |
Information | This class provides a complete unit test environment. Classes which have test methods can be registered here. Then the methods will automatically be called by using reflection. The test results are logged in files. |
Constants Summary | |
---|---|
CATEGORY , LOGLEVEL |
Globals Summary | |
---|---|
CurrentTypeID , TypeNameList |
Functions Summary | |
---|---|
AssertByteAreEqual | Checks if two Byte values are equal. |
AssertDoubleAreEqual | Checks if two Double values are equal. |
AssertFalse | Checks if an expression is false. |
AssertFloatAreEqual | Checks if two Float values are equal. |
AssertIntAreEqual | Checks if two Integer values are equal. |
AssertNotNull | Checks if an object is not null. |
AssertNull | Checks if an object is null%. |
AssertObjectAreEqual | Checks if two Objects are equal. |
AssertTObjectAreEqual | Checks if two TObjects are equal. |
AssertTrue | Checks if an expression is true. |
AssertTypeAreEqual | Checks if the type of two objects is the same. |
Fail | Just makes the test fail. |
SetUpUnitTesting | First function to call. Sets up the test environment. |
StartUnitTesting | This function starts the unit tests. |
TestEnd | Just logs that a certain method ended. |
TestStart | Just logs that a certain method started. |
Const CATEGORY:String | |
Description | UnitTests have their own category. |
Const LOGLEVEL:Int | |
Description | Everything has to be logged. So set the log level to a critical level. |
Global CurrentTypeID:TTypeId | |
Description | The currently used TypeID. (USed for reflection) |
Global TypeNameList:TList | |
Description | List with all registered classes. |
Function AssertByteAreEqual(pbExpectedValue:Byte, pbActualValue:Byte, psTestName:String, psComesFromFile:String, psFileToWriteIn:String) | |
Description | Checks if two Byte values are equal. |
Information | This function checks if pbActualValue equals pbExpectedValue. psTestName is the name of the method which calls this function. psComesFromFile is the filename where the test method is in. psFileToWriteIn is the path to the file where the log should be written in. |
Function AssertDoubleAreEqual(pdExpectedValue:Double, pdActualValue:Double, psTestName:String, psComesFromFile:String, psFileToWriteIn:String) | |
Description | Checks if two Double values are equal. |
Information | This function checks if pdActualValue equals pdExpectedValue. psTestName is the name of the method which calls this function. psComesFromFile is the filename where the test method is in. psFileToWriteIn is the path to the file where the log should be written in. |
Function AssertFalse(pbExpression:Byte, psTestName:String, psComesFromFile:String, psFileToWriteIn:String) | |
Description | Checks if an expression is false. |
Information | This function checks if pbExpression is false. psTestName is the name of the method which calls this function. psComesFromFile is the filename where the test method is in. psFileToWriteIn is the path to the file where the log should be written in. |
Function AssertFloatAreEqual(pfExpectedValue:Float, pfActualValue:Float, psTestName:String, psComesFromFile:String, psFileToWriteIn:String) | |
Description | Checks if two Float values are equal. |
Information | This function checks if pfActualValue equals pfExpectedValue. psTestName is the name of the method which calls this function. psComesFromFile is the filename where the test method is in. psFileToWriteIn is the path to the file where the log should be written in. |
Function AssertIntAreEqual(piExpectedValue:Int, piActualValue:Int, psTestName:String, psComesFromFile:String, psFileToWriteIn:String) | |
Description | Checks if two Integer values are equal. |
Information | This function checks if piActualValue equals piExpectedValue. psTestName is the name of the method which calls this function. psComesFromFile is the filename where the test method is in. psFileToWriteIn is the path to the file where the log should be written in. |
Function AssertNotNull(poObject:Object, psTestName:String, psComesFromFile:String, psFileToWriteIn:String) | |
Description | Checks if an object is not null. |
Information | This function checks if poObject is not null. psTestName is the name of the method which calls this function. psComesFromFile is the filename where the test method is in. psFileToWriteIn is the path to the file where the log should be written in. |
Function AssertNull(poObject:Object, psTestName:String, psComesFromFile:String, psFileToWriteIn:String) | |
Description | Checks if an object is null%. |
Information | This function checks if poObject is null. psTestName is the name of the method which calls this function. psComesFromFile is the filename where the test method is in. psFileToWriteIn is the path to the file where the log should be written in. |
Function AssertObjectAreEqual(poExpectedObject:Object, poActualObject:Object, psTestName:String, psComesFromFile:String, psFileToWriteIn:String) | |
Description | Checks if two Objects are equal. |
Information | This function checks if poActualObject equals poExpectedObject. psTestName is the name of the method which calls this function. psComesFromFile is the filename where the test method is in. psFileToWriteIn is the path to the file where the log should be written in. |
Function AssertTObjectAreEqual(ptoExpectedObject:TObject, ptoActualObject:TObject, psTestName:String, psComesFromFile:String, psFileToWriteIn:String) | |
Description | Checks if two TObjects are equal. |
Information | This function checks if ptoActualObject equals ptoExpectedObject. psTestName is the name of the method which calls this function. psComesFromFile is the filename where the test method is in. psFileToWriteIn is the path to the file where the log should be written in. |
Function AssertTrue(pbExpression:Byte, psTestName:String, psComesFromFile:String, psFileToWriteIn:String) | |
Description | Checks if an expression is true. |
Information | This function checks if pbExpression is true. psTestName is the name of the method which calls this function. psComesFromFile is the filename where the test method is in. psFileToWriteIn is the path to the file where the log should be written in. |
Function AssertTypeAreEqual(poExpectedObject:Object, poActualObject:Object, psTestName:String, psComesFromFile:String, psFileToWriteIn:String) | |
Description | Checks if the type of two objects is the same. |
Information | This function checks if ptoExpectedObject has the same (dynamic) type as ptoActualObject. psTestName is the name of the method which calls this function. psComesFromFile is the filename where the test method is in. psFileToWriteIn is the path to the file where the log should be written in. |
Function Fail(psTestName:String, psComesFromFile:String, psFileToWriteIn:String) | |
Description | Just makes the test fail. |
Information | Use this function if you want a test to fail. psTestName is the name of the method which calls this function. psComesFromFile is the filename where the test method is in. psFileToWriteIn is the path to the file where the log should be written in. |
Function SetUpUnitTesting(ptlTypeNames:TList) | |
Description | First function to call. Sets up the test environment. |
Information | Every class which has test methods has to be registered here. Registering a class is simple. The name of every class has to be in ptlTypeNames. A test method has to begin with 'Test__'. Otherwise it will be ignored. Furthermore, a test method has to have a parameter of the type 'Object'. Attention: The class name has to be the exact name as in your code, because of the reflection. |
Function StartUnitTesting(psFileToWriteIn:String) | |
Description | This function starts the unit tests. |
Information | The test methods of every registered class is invoked here. |
Function TestEnd(psTestName:String, psComesFromFile:String, psFileToWriteIn:String) | |
Description | Just logs that a certain method ended. |
Information | This function can be called when a test method ends. Just makes the log files nicer. psTestName is the name of the method which calls this function. psComesFromFile is the filename where the test method is in. psFileToWriteIn is the path to the file where the log should be written in. |
Function TestStart(psTestName:String, psComesFromFile:String, psFileToWriteIn:String) | |
Description | Just logs that a certain method started. |
Information | This function can be called when a test method starts. Just makes the log files nicer. psTestName is the name of the method which calls this function. psComesFromFile is the filename where the test method is in. psFileToWriteIn is the path to the file where the log should be written in. |
Version | v1.00 |
---|---|
Author | M0rgenstern - Siliziumbrain - Kevin Peter Hoffeld |
License | Public Domain |
History v1.00 | 15 July 2012 - Final Release |