【问题标题】:coded ui -- are test results stored for assert methods in htmlcoded ui -- 是为 html 中的 assert 方法存储的测试结果
【发布时间】:2015-10-27 11:07:16
【问题描述】:

我想将我的断言方法的测试结果存储在 excel 中。

但是我检查了在项目的“TestResults”文件夹中创建的html文件,它没有记录任何关于assert方法的内容。

The html log file is shown as follows

如何查看此 TestMethod 中创建的每个断言方法的测试结果

【问题讨论】:

  • 你不能。网上有很多关于同一主题的问题,也有一些关于如何实现你想要的想法的想法。尝试搜索网络。
  • 你碰巧知道任何网站或博客。因为我已经搜索了几个星期,但还没有找到任何东西
  • 尝试在网络上搜索“coded ui continue after assert failure”等。还有look here.

标签: coded-ui-tests


【解决方案1】:

是的,该链接非常有帮助。同时我找到了另一种方法来获得我的断言结果。如下:-
(1) 将您的断言方法添加到 UIMap.cs (2) 为每个 Asser.AreEqual(expected, actual) 应用一个 try catch (3) 现在在执行时,如果您进入 catch 块,请记录相应的消息

像这样……

public void AssertMethod_Panel()
        {
            #region Variable Declarations
            HtmlDiv uISolutPane = this.UIInternetExploWindow.UIDocument1.UISolutPane;
            #endregion



            try
            {
                // Verify that the 'Exists' property of panel equals 'True'
                Assert.AreEqual(this.AssertMethod_Panel.uISolutPaneExists, uISolutPane.Exists);

            }
            catch
            {

                File.AppendAllText("C:\\TestResultFailed.txt", "control doe not exists" + Environment.NewLine);

            }

         }

因此,如果您在“TestResultFailed.txt”中获得任何条目,则意味着您的测试失败。

【讨论】:

  • 显然这涉及到将我的assert方法添加到UIMap中的大量工作,然后为每个assert方法编写try catch....希望得到一个更简单的解决方案。
猜你喜欢
  • 1970-01-01
  • 2011-12-13
  • 1970-01-01
  • 2010-09-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-10-19
  • 2016-06-22
相关资源
最近更新 更多