可以“用于编码 UI 测试的 Excel 加载项”吗?从 Excel 工作表读取测试场景数据时提供帮助

发布于 2024-10-15 07:51:38 字数 3516 浏览 1 评论 0原文

这需要详细解释。

假设我有一个 Excel 电子表格,其中一个工作表中包含测试用例 我可能在另一个工作表中期望(验证)消息(除了第一个工作表中的预期消息之外)。

第一个工作表与第二个工作表中的字段值之间也存在一些链接。

请参阅:欢迎,<名字> <姓氏> 作为示例。
您可以在“测试用例”工作表的“预期结果”字段中看到该字段的值为: “用户将进入“我的帐户”页面,并显示以下欢迎消息: “&Messages!$B$1244&”,其中名字是 Dave,姓氏是 Brown。”

因此“&Messages!$B$1244&”表示工作表“Messages”中的字段 B1244

现在是问题。< br> 如果我获得了电子商务网站的所有测试用例(例如下面的示例),我如何基于此输入使用编码 UI 测试?我可以自动化 Excel,使用测试用例工作表中的步骤并将其与数据输入和验证的编码 UI 记录相结合。

我相信我需要进行手动编码,部分使用记录的输入步骤和验证编码 UI 记录器并可能使用手动编程进行验证。 我想听听其他人是否做过类似的事情。

我想通过编写功能/用户故事将其合并到 Specflow BDD 中,这些测试用例将成为场景。

任何成功,关于使用 Excel 测试自动化作为数据驱动测试的想法。

谢谢 Rad

Test cases worksheet named "Test cases":
=====================
Test Case Name    Test Case Objective  
frontstore.01-3   Register a shopper from order 
                  confirmation page with valid inputs  

# Step                                Data                           Expected Results  
------------------------------------------------------------------------------------------------
1 Launch the test storefront            http://testserver.com/index Welcome page is loaded.  
2 Click Sign In link                                                   Sign In page is loaded.  
3 Click Register under New Customer                                    Register page is loaded.  
4 Enter valid inputs and click Submit     "Logon ID = TestUser                               
                                           Firstname = John                                   
                                           Lastname = Clark                                
                                           ... (other fields)          Registration Successful.  
                                                                       The user is taken to My Account page   
                                                                       and following welcome message is displayed:   
                                                                       Welcome, <First Name> <Last Name>, where First name is  
                                                                       David and Last Name is Brown."  


Validation Messages worksheet named "Messages":  
=====================  
#Text used in MyAccountPages  
---------------------------------------------------------------------------  
MA_WELCOME                                    Welcome, <First Name> <Last Name>  

阅读了一些有关编码 UI 测试的内容后: 这当然可以做到,但数据/句子如:

“启动测试店面”
“点击登录链接”

“注册成功。
用户被带到“我的帐户”页面
并显示以下欢迎消息:
欢迎,,名字是
David and Last Name is Brown.”

包含操作和数据,因此我需要深入了解句子的各个部分 将其转换为操作并绑定到参数。 如果我理解得很好,数据绑定只能用于将列值绑定到某些参数。 所以我需要一些方法来自动识别这些句子的含义并使用一些绑定 从它的一部分。

因此,如果我有一句话:

“启动测试店面”,它将被翻译为:

CurrentBrowser.Navigate(Helper.TranslateTargetUrlFrom(“测试店面”)) 其中“测试店面”可能解析为 http://testserver.com/index 店面主页 页面,我可以忽略 URL 的数据列 或者我可以捕获 Launch 关键字来表示 CurrentBrowser.Navigate(ColumnValue(Data)) 并忽略句子的“测试店面”部分。

“单击登录链接”可以翻译为 CurrentBrowser.FindLink(“登录”).Click(),

因此在这种情况下,我需要知道登录是 链接的文本,我再次需要提取“登录”来表示链接的文本。

我认为这是 CodedUI 的手动风格,我可以对某些操作进行小型记录,并依赖于手动提取术语 给出的句子。

我想知道如何在语义上编写更好的测试用例以实现自动化。我可能需要某种自由形式 测试用例解析器可以识别某些单词的语义,例如:单击、导航、启动、输入、单击等,并将其翻译为 通过重新使用现有的帮助器方法和记录的操作来编写代码并进行一些手动绑定,但不是使用列中的整个数据值,而是 提取的值。

对这种自动化有什么想法吗?

This requires a detailed explanation.

Imagine that I have an Excel spreadsheet with test cases in one worksheet
and I may have expected (validation) messages in another (in addition to expected messages in the first worksheet).

There is also some linking between the values of fields in one to the second worksheets.

See: Welcome, <First Name> <Last Name> as an example.
You can see in the "Expected Results" field in "Test cases" worksheet the value of the field is:
"The user is taken to My Account page and following welcome message is displayed:
"&Messages!$B$1244&", where First name is Dave and Last Name is Brown."

so "&Messages!$B$1244&", denotes field B1244 in worksheet "Messages"

Now the question.
If I am given all test cases like the example below for an ecommerce web site, how can I use Coded UI Testing based on this input? Can I automate Excel, use the steps in test case worksheet and combine that with Coded UI recording of data input and verification.

I believe I would need to do manual coding, partially using recorded input steps and verifications from Coded UI recorder and possibly using manual programming for verification.
I would like to hear if others have done something similar.

I would like to incorporate this into Specflow BDD, by writing feature/user story and these test cases will be scenarios.

Any success, thoughts on using Excel test automation as data driven testing.

Thanks
Rad

Test cases worksheet named "Test cases":
=====================
Test Case Name    Test Case Objective  
frontstore.01-3   Register a shopper from order 
                  confirmation page with valid inputs  

# Step                                Data                           Expected Results  
------------------------------------------------------------------------------------------------
1 Launch the test storefront            http://testserver.com/index Welcome page is loaded.  
2 Click Sign In link                                                   Sign In page is loaded.  
3 Click Register under New Customer                                    Register page is loaded.  
4 Enter valid inputs and click Submit     "Logon ID = TestUser                               
                                           Firstname = John                                   
                                           Lastname = Clark                                
                                           ... (other fields)          Registration Successful.  
                                                                       The user is taken to My Account page   
                                                                       and following welcome message is displayed:   
                                                                       Welcome, <First Name> <Last Name>, where First name is  
                                                                       David and Last Name is Brown."  


Validation Messages worksheet named "Messages":  
=====================  
#Text used in MyAccountPages  
---------------------------------------------------------------------------  
MA_WELCOME                                    Welcome, <First Name> <Last Name>  

After reading a bit about Coded UI testing:
It can certainly be done, but data/sentences like:

“Launch the test storefront”
“Click Sign In link”

“Registration Successful.
The user is taken to My Account page
and following welcome message is displayed:
Welcome, , where First name is
David and Last Name is Brown."

contain both actions and data so I need to drill down into parts of the sentence to
translate it to actions and binding to parameters.
If I understand well data binding can only be used to bind column values to some parameters.
So I need some way to automatically recognize the meaning of these sentences and use some binding
from parts of it.

So if I have a sentence:

“Launch the test storefront” that would be translated to:

CurrentBrowser.Navigate(Helper.TranslateTargetUrlFrom(“test storefront”))
where “test storefront” might resolve to http://testserver.com/index storefront home
page and I can ignore Data column for URL
or I can capture Launch keyword to mean CurrentBrowser.Navigate(ColumnValue(Data)) and ignore “test storefront” part of the sentence.

“Click Sign In link” could be translated to CurrentBrowser.FindLink(“Sign In”).Click(),

so it this case I will need to know that Sign In is
the text of the link, again I need to extract “Sign In” to mean the text of a link.

I see this as pretty manual style of CodedUI where I could do small recording for some actions and rely on manual extractions of terms from
given sentences.

I would like to know how can I semantically write better test cases to allow automation. I would probably need some kind of free form
test case parser that would recognize the semantic meaning of some words like: click, navigate, launch, enter, click under etc and translate this into
code by re-using existing helper methods and recorded actions and do some manual binding, but not with the whole data value in the column, but
an extracted value.

Any idea of this kind of automation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苦妄 2024-10-22 07:51:38

我认为您可以通过数据绑定输入参数并仅读取 Excel 作为数据源来做到这一点,您将需要使用 CodedUI 而不是 MTM + Fast Forward

I think yould could do this by data binding the input parameters and just reading Excel as a datasource, you are going to need to use CodedUI for that not MTM + Fast Forward

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文