在Selenium IDE中预填充新的测试用例(Prefill new test cases in Selenium IDE)

编程入门 行业动态 更新时间:2024-10-22 13:37:59
在Selenium IDE中预填充新的测试用例(Prefill new test cases in Selenium IDE)

我正在使用Selenium IDE 2.3.0在我的Web应用程序中记录操作并创建测试。

在每次测试之前,我必须清除所有cookie,加载主页面,与特定用户一起登录并提交登录表单。 这些~10个命令是固定的,每个测试用例都需要它们,但我不想每次都从其他测试中记录或复制它们。

有没有办法配置如何创建“空”测试用例?

我知道我可以创建一个prepare.html文件或其他东西,并将其添加到测试套件中。 但我需要能够同时运行单个测试或所有测试,因此每个测试用例都必须包含命令。

I'm using Selenium IDE 2.3.0 to record actions in my web application and create tests.

Before every test I have to clear all cookies, load the main page, log in with a specific user and submit the login form. These ~10 commands are fix and every test case needs them, but I don't want to record or copy them from other tests every time.

Is there a way to configure how "empty" test cases are created?

I know I could create a prepare.html file or something and prepend it to a test suite. But I need to be able to run either a single test or all tests at once, so every test case must include the commands.

最满意答案

Selenium支持面向对象的设计。 您应该创建一个类,该类接受您引用的那些命令并始终执行这些命令,在您执行的每个测试中,您可以调用该类和支持方法然后执行它。

这是一个很好的资源。

Ok I finally came up with a solution that suits me. I wrote custom commands setUpTest and tearDownTest, so I only have to add those two manually to each test.

I used this post to get started: Adding custom commands to Selenium IDE

更多推荐

本文发布于:2023-07-06 07:32:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1047352.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:测试   IDE   Selenium   cases   test

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!