How to test?

Cholo Lennon chololennon at hotmail.com
Sat Apr 25 20:10:51 EDT 2020


On 4/25/20 2:16 AM, Manfred Lotz wrote:
> On Fri, 24 Apr 2020 19:12:39 -0300
> Cholo Lennon <chololennon at hotmail.com> wrote:
> 
>> On 24/4/20 15:40, Manfred Lotz wrote:
>>> I have a command like application which checks a directory tree for
>>> certain things. If there are errors then messages will be written to
>>> stdout.
>>>
>>> How to test this in the best way?
>>>
>>> One idea was for the error situations to write messages to files and
>>> then later when running the tests to compare the error messages
>>> output to the previously saved output.
>>>
>>> Is there anything better?
>>>
>>>    
>>
>> Maybe I am wrong because I don't understand your scenario: If your
>> application is like a command, it has to return an error code to the
>> system, a distinct number for each error condition. The error code is
>> easier to test than the stdout/stderr.
>>
> 
> Yes, a different error code for each condition is good to test.
> However, I need to test as well the correct file name and other values
> belonging to a certain error condition.

So, I though that you were testing your application from an "external 
point of view", running it and validating its behavior. This is not the 
case... if you need such degree of control over its functionality, IMHO, 
you just need a unit test framework to validate every part of it.

If you still need to execute the application to test it, the best way, 
as other suggested, it is to log the working conditions. You can design 
very well the log information in order to simplify the parsing of it.

--
Cholo Lennon
Bs.As.
ARG


More information about the Python-list mailing list