Exemplo n.º 1
0
 /// <summary>
 /// Logs the result of a test case.
 /// </summary>
 /// <param name="result">The result of the test case.</param>
 /// <remarks>TestCase uses this method to mark the final result of a test step. Please don't call it yourself.</remarks>
 public void WriteResult(TestCaseResult result)
 {
     _writer.WriteStartElement("LogResult");
     _writer.WriteString(result.ToString());
     _writer.WriteEndElement();
     _writer.Flush();
 }
Exemplo n.º 2
0
        private void SetIconToNode(QAliberTreeNode node, TestCaseResult result)
        {
            if (node != null)
            {
                if (node.Testcase != null)
                {
                    string type = node.Testcase.GetType().FullName;
                    switch (result)
                    {
                    case TestCaseResult.None:
                        if (testcaseIconsList.Images.ContainsKey(type))
                        {
                            node.SelectedImageKey = node.ImageKey = type;
                        }
                        else
                        {
                            if (node.Testcase.Icon == null)
                            {
                                node.SelectedImageKey = node.ImageKey = "Generic";
                            }
                            else
                            {
                                testcaseIconsList.Images.Add(type, node.Testcase.Icon);
                                node.SelectedImageKey = node.ImageKey = type;
                            }
                        }
                        return;

                    case TestCaseResult.Passed:
                    case TestCaseResult.Failed:
                        string pfType = type + "---" + result.ToString();
                        if (!testcaseIconsList.Images.ContainsKey(pfType))
                        {
                            Bitmap bitmap = new Bitmap(16, 16);
                            using (Graphics graphics = Graphics.FromImage(bitmap))
                            {
                                if (!testcaseIconsList.Images.ContainsKey(type))
                                {
                                    type = "Generic";
                                }
                                graphics.DrawImage(testcaseIconsList.Images[type], 0, 0);
                                if (result == TestCaseResult.Failed)
                                {
                                    graphics.DrawImage(Properties.Resources.Error, 7, 0);
                                }
                                else
                                {
                                    graphics.DrawImage(Properties.Resources.Pass, 7, 0);
                                }
                                testcaseIconsList.Images.Add(pfType, bitmap);
                            }
                        }
                        node.SelectedImageKey = node.ImageKey = pfType;
                        break;

                    default:
                        break;
                    }
                }
            }
        }