Finds test sets in a folder,
for each testset
for each test in the testset
for each run of the test
Using this same structure you can locate the run you want to mess with, and then set its 'STATUS' field to be whatever you want.
eg, in C# you can either attempt this via
Run.Status = "Failed";
Run.Status = "Pass";
However, if you wish to specify a specific Step in your test which failed, then you need to get the
StepFactory object, and then locate the Step Collection/List associated with that run, and iterate through the Steps.