This example requires that there is a FAT test in your WATS account (can be submitted from the client config)
Here is a test method as picture (the text code can be found at the bottom of this article):
public void LoadUUTReport()
{
TDM api = new TDM();
api.InitializeAPI(true); //API ready for use. NB Has to be configured in WATS Client first
WatsReportHeader[] h = api.FindReports("(PN eq 'WATS FAT') and (ReportType eq 'UUT')", 1); //Find first report
Assert.AreEqual(1, h.Length);
UUTReport r = (UUTReport)api.LoadReport(h[0].Guid.ToString()); //Retrieve the whole report
Assert.IsTrue(r.SerialNumber.StartsWith("FATTest"));
//The following shows how to get information from the report retrieved
UUTPartInfo[] pInfo = r.PartInfo;
Assert.AreEqual(2, pInfo.Length);
Step[] allSteps = r.AllSteps;
Step[] failedSteps = r.FailedSteps;
Step[] specificSteps = r.FindSteps("SinglePass", "/pass/fail tests/");
SequenceCall[] allSequenceSteps = r.AllSteps.OfType<SequenceCall>().ToArray();
NumericLimitStep stepOfInterest = r.AllSteps.Where(s => s.Name == "SingleGELEFail").FirstOrDefault() as NumericLimitStep;
Assert.IsNotNull(stepOfInterest);
NumericLimitTest numericLimitTest = stepOfInterest.Tests[0];
Assert.AreEqual(500, numericLimitTest.NumericValue);
Assert.AreEqual(501, numericLimitTest.LowLimit);
Assert.AreEqual(502, numericLimitTest.HighLimit);
StringValueStep stringValueStepFromMultiple = r.AllSteps.Where(s => s.Name == "Multiple tests" && s.StepPath == "/stringvalue tests/").FirstOrDefault() as StringValueStep;
Assert.IsNotNull(stringValueStepFromMultiple);
StringValueTest stringValueTest = stringValueStepFromMultiple.Tests.Where(t => t.MeasureName == "MultiCasePass").FirstOrDefault();
Assert.IsNotNull(stringValueTest);
Assert.AreEqual("CaseSensitive", stringValueTest.StringValue);
Assert.AreEqual("CaseSensitive", stringValueTest.StringLimit);
Step graphStep = r.FindSteps("Fibionacci", null).First();
Chart chart = graphStep.Chart;
double[] xValues, yValues;
chart.Series[0].GetValues(out xValues, out yValues);
Assert.AreEqual(13, xValues.Length);
Attachment attachment = r.FindSteps("Attach file", null).First().Attachment;
Assert.AreEqual("winhlp32.exe", attachment.FileName);
Assert.IsTrue(attachment.Data.Length > 10);
}
Comments
0 comments
Please sign in to leave a comment.