Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Extremely lightweight testing tool
Message
De
16/08/2006 10:18:20
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Refactorisation et unité d'essai
Divers
Thread ID:
01145611
Message ID:
01145997
Vues:
21
>I am having some issue with the parentheses and not able to compile.
>
>DLC

Strange, it works for me... ;) The only thing I can think of offhand is the parens in SET CLASSLIB TO (Classlibs); I typed that in manually when I removed my classlibs. Have you got a line number or error message?


>>I'm trying to buy into Unit Testing, but when I downloaded Fox Unit, I found it to be a lot "heavier" than I wanted to get into. So, I wrote my own testing code. Seeing UT add this category, I figured I'd offer it to the public. No comments yet since I wrote it myself.
>>
>>
>>CLOSE ALL
>>CLEAR ALL EXTENDED
>>SET CLASSLIB TO (Classlibs)
>>SET ESCAPE ON
>>SET SAFETY OFF
>>SET DEBUGOUT TO Results.txt
>>
>>UnitTest("TestDemo", "[Parameter]")
>>
>>SET DEBUGOUT TO
>>CLEAR ALL EXTENDED
>>CLOSE ALL
>>MODIFY COMMAND Results.txt NOWAIT
>>
>>PROCEDURE UnitTest
>>	LPARAMETERS tTestSet
>>	LOCAL s
>>	TestHarness = CREATEOBJECT("TestHarness")
>>	IF PEMSTATUS(TestHarness, LEFT(tTestSet, AT("(",tTestSet)-1), 5)
>>		s = SECONDS()
>>		TestHarness.&tTestSet
>>		DEBUGOUT SECONDS() - s
>>	ELSE
>>		TestHarness.TestExpr(tTestSet+" Test Not Found", ".F.")
>>	ENDIF
>>	DEBUGOUT ' '
>>	RELEASE TestHarness
>>
>>DEFINE CLASS TestHarness AS Custom
>>PROCEDURE TestExpr
>>	LPARAMETERS tMessage, tExpression
>>	DEBUGOUT IIF(EVALUATE(tExpression), "Pass   ", "Failed!"), tMessage+":", "["+tExpression+"]"
>>PROCEDURE TestRecord
>>	LPARAMETERS tAlias, tAllRecords
>>	LOCAL tSelect, tScanFor, tRecord, tRecNo
>>	LOCAL ARRAY tRecordArray[1,1]
>>	tSelect = SELECT(0)
>>	SELECT (tAlias)
>>	IF RECCOUNT() <> 0
>>		tRecNo = RECNO()
>>		AFIELDS(tRecordArray, tAlias)
>>		tScanFor = IIF(tAllRecords, "", "NEXT 1")
>>		SCAN &tScanFor
>>			tRecord = ''
>>			FOR tLoop = 1 TO ALEN(tRecordArray,1)
>>				tRecord = tRecord + TRANSFORM(EVAL(tRecordArray[tLoop,1]))+" "
>>			ENDFOR
>>			This.TestExpr(tRecord, ".T.")
>>		ENDSCAN
>>		GOTO tRecNo
>>	ELSE
>>		This.TestExpr("No Records Found", ".F.")
>>	ENDIF
>>	SELECT (tSelect)
>>PROCEDURE TestFunction
>>	LPARAMETERS tFunction, tTest
>>	tObject = "This."+LEFT(tFunction, RAT(".",tFunction)-1)
>>	IF PEMSTATUS(&tObject, SUBSTR(tFunction, RAT(".",tFunction)+1, RAT("(", tFunction)-RAT(".",tFunction)-1), 5)
>>		tRetVal = This.&tFunction
>>		tTest = EVL(tTest, ".T.")
>>		This.TestExpr(tFunction+": "+TRANSFORM(tRetVal), tTest)
>>	ELSE
>>		This.TestExpr(tFunction+" Function Not Found", ".F.")
>>		tRetVal = .f.
>>	ENDIF
>>	RETURN tRetVal
>>
>>PROCEDURE TestDemo
>>	LPARAMETERS tParameter
>>	This.AddProperty("oDemo", CREATEOBJECT("Demo")
>>	This.TestFunction("oDemo.FunctionName()", "Expected Result")
>>	This.TestExpr("tParameter", "Expected Result")
>>	This.TestRecord("TableName", lAllRecords)
>>	This.TestFunction("oDemo.Release()")
>>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform