Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a script to run through all the application mod
Message
From
27/06/2006 20:22:35
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01132096
Message ID:
01132233
Views:
19
>I think I've realized that on my second try. Anyway, do you have a testunit sample class, so I should know how to write this test?

See below. I think this code is typical of a test class. It uses the three "Assert" methods: AssertNotNull, AssertEquals, and AssertTrue. Also, I selected the FoxUnit setting to use the value of the property icTestPrefix as the prefix for methods that should be considered tests.

>I went to discussion board and saw that there was an idea to create a full documentation. Where can I find it?

More documentation than what you find on the FoxUnit site does not exist, as far as I know. However, you might want to ask Jim Irwin or another developer at VisionPace who is associated with the project.

Chris
**********************************************************************
DEFINE CLASS TestConvert AS FxuTestCase OF FxuTestCase.prg
   **********************************************************************

   #IFNDEF CRLF
      #DEFINE CRLF CHR(13) + CHR(10)
   #ENDIF
    
   #IF .F.
      LOCAL THIS AS TestConvert OF TestConvert.PRG
   #ENDIF

   icTestPrefix = "Test"
   ioObjectToTest = .NULL.

   ********************************************************************
   FUNCTION SETUP
      THIS.ioObjectToTest = NEWOBJECT("Convert", "Convert.prg")
   ENDFUNC

   ********************************************************************
   FUNCTION TearDown
      This.ioObjectToTest = .NULL.
   ENDFUNC

   ********************************************************************
   FUNCTION TestObjectCreated()
      THIS.AssertNotNull("The Convert object was not created.", ;
         THIS.ioObjectToTest)
   ENDFUNC

   ********************************************************************
   FUNCTION TestGetEmptyValue()
      WITH This.ioObjectToTest As Convert of Convert.prg
         This.Assertequals("GetEmptyValue('C') failed to return an empty character", ;
            '', .GetEmptyValue('C'))
         This.Assertequals("GetEmptyValue('M') failed to return an empty character", ;
            '', .GetEmptyValue('C'))
            
         This.Asserttrue("GetEmptyValue('O') failed to return .NULL.", ;
            ISNULL(.GetEmptyValue('O')))
         * etc.
      ENDWITH    
   ENDFUNC
  
   ********************************************************************
   FUNCTION TestGetTypeCode()
      WITH This.ioObjectToTest As Convert of Convert.prg
         This.Assertequals("GetTypeCode('') failed to return 'C'", ;
            'C', .GetTypeCode(''))
         * etc.
      ENDWITH
   ENDFUNC

   *** SEVERAL OTHER TEST FUNCTIONS REMOVED

ENDDEFINE
Christopher Bohling, Consultant
http://www.ChristopherBohling.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform