For procedures, the "do something" usually involves API calls or other object manipulations.
For example, a procedure may write a row to a file. It uses File I/O API calls (or a File IO object) to do this "write a row".
What you want to do is create "mock" object to stand in for the File. The Mock object has just enough functionality to collect the test results and make them visible to an assertion. Don't overwrite your mock objects, it's a rat-hole of lost time.
In Python, we do things like this.
class MockFile( object ):
def __init__( self, aFileName, aMode ):
self.name= aFileName
self.mode= aMode
self.buffer= None
def write( self, aRow ):
self.buffer= str(aRow)
Now we can provide this mock file to our procedure instead of a real file. Ans we can make assertions about what happened.
class TestSomeProcedure( unittest.TestCase ):
def testWrite( self ):
mockFile= MockFile( "name", "w" )
theProcedureImTesting( args, args, args, mockFile )
self.assertEquals( "The Row It Was Supposed to Write\n", mockFile.buffer )