CodedUI数据驱动的测试问题,我很欣赏,如果有些机构可以帮助我。 [英] CodedUI data driven test question, I appreciate if some body could help me in it.

查看:74
本文介绍了CodedUI数据驱动的测试问题,我很欣赏,如果有些机构可以帮助我。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,我是VSTS的新手,我正在使用教程和示例来完成它。所有示例都显示为This.UImap。 ,但当我记录我得到了我.Uimap。

Hi friends, I am new to VSTS, i am using the tutorial and examples to do it.All the examples showing as This.UImap. , but when i record i am getting Me.Uimap.

1。为什么我会得到我。而不是这个。

1. why i am getting ME. instead This.

2。当我尝试按照教程进行数据驱动时 使用CSV文件。我收到2个错误

2. when i try to do the data driven following the tutorial  using CSV file. i am getting 2 errors

  错误    1    "System.Data.DataRow"类型的值无法转换为"字符串"。

   Error    1    Value of type 'System.Data.DataRow' cannot be converted to 'String'.

  错误    2   标识符预期。  并且光标指向电子邮件引号的前面..

   Error    2    Identifier expected.   and the cursor pointing infront of the email quotes..

下面是简单代码。



< CodedUITest ()> b
公共类CodedUITest1



    < DataSource(" Microsoft.VisualStudio.TestTools.DataSource.CSV"," | DataDirectory | \ hihi.csv"," hihi#csv",DataAccessMethod.Sequential)> < DeploymentItem(QUOT; TestProject1\hihi.csv")> < TestMethod()>

    Public Sub CodedUITestMethod1()

        "&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;


        '要为此测试生成代码,请选择"为编码的UI测试生成代码"。从快捷菜单中选择一个菜单项。

       有关生成代码的详细信息,请参阅http://go.microsoft.com/fwlink/?LinkId=179463
$
        '
$
        Me.UIMap.RecordedMethod1Params.UILoginEditText = TestContext.DataRow [" email1"]。ToString()

        Me.UIMap.RecordedMethod1()

   结束点¥


#Region"附加测试属性"

        '
$
        '您可以在编写测试时使用以下附加属性:

        '
$
        ''在运行每项测试之前使用TestInitialize运行代码

        "< TestInitialize()> Public Sub MyTestInitialize()

        "&NBSP;&NBSP;&NBSP; '
$
        "&NBSP;&NBSP;&NBSP; '要为此测试生成代码,请选择"为编码的UI测试生成代码"。从快捷菜单中选择一个菜单项。

        "&NBSP;&NBSP;&NBSP;有关生成代码的详细信息,请参阅http://go.microsoft.com/fwlink/?LinkId=179463
$
        "&NBSP;&NBSP;&NBSP; '
$
        '结束点¥


        ''在每次测试运行后使用TestCleanup运行代码

        "< TestCleanup()> Public Sub MyTestCleanup()

        "&NBSP;&NBSP;&NBSP; '
$
        "&NBSP;&NBSP;&NBSP; '要为此测试生成代码,请选择"为编码的UI测试生成代码"。从快捷菜单中选择一个菜单项。

        "&NBSP;&NBSP;&NBSP;有关生成代码的详细信息,请参阅http://go.microsoft.com/fwlink/?LinkId=179463
$
        "&NBSP;&NBSP;&NBSP; '
$
        '结束点¥


#End地区



       &NBSP; '''< summary>

        '''获取或设置测试上下文,提供

        '''有关当前测试运行的信息和功能。

        '''< / summary>

       公共属性TestContext()As TestContext

           获取¥b $ b               返回testContextInstance

           结束获取¥b $ b           设置(ByVal值为TestContext)

                testContextInstance =值

           结束集

       结束物业



        Private testContextInstance As TestContext



    Public ReadOnly Property UIMap As TestProject1.UIMap

       获取¥b $ b           如果(Me.map Is Nothing)则为
                Me.map = New TestProject1.UIMap()

           结束如果



           返回Me.map

       结束获取¥b $ b   结束物业

   私有地图As TestProject1.UIMap

结束等级




<CodedUITest()>
Public Class CodedUITest1

    <DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\hihi.csv", "hihi#csv", DataAccessMethod.Sequential)> <DeploymentItem("TestProject1\hihi.csv")> <TestMethod()>
    Public Sub CodedUITestMethod1()
        '           
        ' To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
        ' For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
        '
        Me.UIMap.RecordedMethod1Params.UILoginEditText = TestContext.DataRow["email1"].ToString()
        Me.UIMap.RecordedMethod1()
    End Sub

#Region "Additional test attributes"
        '
        ' You can use the following additional attributes as you write your tests:
        '
        '' Use TestInitialize to run code before running each test
        '<TestInitialize()> Public Sub MyTestInitialize()
        '    '
        '    ' To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
        '    ' For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
        '    '
        'End Sub

        '' Use TestCleanup to run code after each test has run
        '<TestCleanup()> Public Sub MyTestCleanup()
        '    '
        '    ' To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
        '    ' For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
        '    '
        'End Sub

#End Region

        '''<summary>
        '''Gets or sets the test context which provides
        '''information about and functionality for the current test run.
        '''</summary>
        Public Property TestContext() As TestContext
            Get
                Return testContextInstance
            End Get
            Set(ByVal value As TestContext)
                testContextInstance = Value
            End Set
        End Property

        Private testContextInstance As TestContext

    Public ReadOnly Property UIMap As TestProject1.UIMap
        Get
            If (Me.map Is Nothing) Then
                Me.map = New TestProject1.UIMap()
            End If

            Return Me.map
        End Get
    End Property
    Private map As TestProject1.UIMap
End Class

 

推荐答案

当您使用VB作为编码语言时,"我"指的是相当于"这个"在C#。

As you are using VB as your language for coding, "Me" is the equivalent of "this" in C#.

问候,

Pankaj


这篇关于CodedUI数据驱动的测试问题,我很欣赏,如果有些机构可以帮助我。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆