Selenium学习(十三) selenium IDE之测试实例讲解

目录

基本要求

准备内容

用例简介

IDE实例

side文件

经验总结


本要求

1、测试人员要懂一点前端html/js的知识,要不然遇到问题很难调试解决;
2、测试人员又有编写测试用例、验证操作用例的经验或能力
另,测试用例编写可参考https://blog.csdn.net/sinat_41392571/article/details/80885242,是一个登录功能相对完整、相对细的用例,主要是涉及的面比较广,考虑的角度相对较多

 

准备内容

1、测试对象:测试的网站/网页
2、测试用例:编写好的测试用例
3、测试标准/方案:用例实施的方案、用例是否通过的标准

 

用例简介

本次实例选择的网站是选择的是禅道,禅道是一个项目管理工具,包括需求、测试等管理功能,之前用的,还不错。
禅道可以上官网下载https://www.zentao.net/,本次下载的是专业版,可以免费试用。下载好以后一件启动,添加基础产品信息,就可以进入到缺陷模块添加缺陷了。
本次实例选的是,缺陷新增功能,简单编写了以下几个用例。
1、【正向用例】新增时填写核心字段,判断新增成功后,主列表是否能查询到新增的缺陷;
2、【正向用例】新增时填写全部字段,判断新增成功后,详细界面是否能查询到所有的信息项;
3、【反向用例】必填项验证,判断界面必填是否通过;
4、【反向用例】必填项空白输入验证,判断界面必填项输入空格是否通过;
5、【反向用例】输入项长度校验,判断部分输入项输入长度超长的情况下是否通过(实际用例比较严谨的情况下应该是每个字段,用例的输入是需求,具体看需求要求);

 

IDE实例

1、【正向用例】新增时填写核心字段,判断新增成功后,主列表是否能查询到新增的缺陷;


2、【正向用例】新增时填写全部字段,判断新增成功后,详细界面是否能查询到所有的信息项;


3、【反向用例】必填项验证,判断界面必填是否通过;


4、【反向用例】必填项空白输入验证,判断界面必填项输入空格是否通过;


5、【反向用例】输入项长度校验,判断部分输入项输入长度超长的情况下是否通过(实际用例比较严谨的情况下应该是每个字段,用例的输入是需求,具体看需求要求);

side文件

{
  "id": "3c155f92-30b2-45f9-a3de-fa8a0c75874a",
  "version": "2.0",
  "name": "shili",
  "url": "http://127.0.0.1/pro/bug-view-50.html",
  "tests": [{
    "id": "9eb14f97-7244-4bdd-ab11-5db56d45d206",
    "name": "CASE-F1-ADD F01",
    "commands": [{
      "id": "2b51a7b7-45dc-488d-9161-f0bd602fec6d",
      "comment": "",
      "command": "//核心字段新增,列表title验证",
      "target": "",
      "targets": [],
      "value": ""
    }, {
      "id": "d7e7ce8e-ecb3-4947-ab3d-e35a528fd67e",
      "comment": "",
      "command": "open",
      "target": "http://127.0.0.1/pro/bug-create-1-0-moduleID=0.html",
      "targets": [],
      "value": ""
    }, {
      "id": "0348f8c9-0373-47a0-b5ce-cec7a4296f0e",
      "comment": "",
      "command": "executeScript",
      "target": "return Math.floor(Math.random()*100)",
      "targets": [],
      "value": "index"
    }, {
      "id": "25b6638d-d5ef-4773-a1e1-6a399ad03e4d",
      "comment": "",
      "command": "click",
      "target": "css=#project_chosen span",
      "targets": [
        ["css=#project_chosen span", "css:finder"],
        ["xpath=//div[@id='project_chosen']/a/span", "xpath:idRelative"],
        ["xpath=//span/div/a/span", "xpath:position"]
      ],
      "value": ""
    }, {
      "id": "0071e1b7-cbf4-49ae-8aeb-b761c2bd84f6",
      "comment": "",
      "command": "click",
      "target": "css=#openedBuild_chosen .default",
      "targets": [
        ["css=#openedBuild_chosen .default", "css:finder"],
        ["xpath=//input[@value=' ']", "xpath:attributes"],
        ["xpath=//div[@id='openedBuild_chosen']/ul/li/input", "xpath:idRelative"],
        ["xpath=//li/input", "xpath:position"]
      ],
      "value": ""
    }, {
      "id": "0e691d0b-87a7-4cd9-9356-820034b6314f",
      "comment": "",
      "command": "click",
      "target": "css=.chosen-results > li",
      "targets": [
        ["css=.chosen-results > li", "css:finder"],
        ["xpath=//div[@id='openedBuild_chosen']/div/ul/li", "xpath:idRelative"],
        ["xpath=//td[2]/div/div/div/ul/li", "xpath:position"]
      ],
      "value": ""
    }, {
      "id": "9bddccfb-323c-4bda-a7ac-4f70b717047b",
      "comment": "",
      "command": "mouseDown",
      "target": "css=#assignedTo_chosen span",
      "targets": [
        ["css=#assignedTo_chosen span", "css:finder"],
        ["xpath=//div[@id='assignedTo_chosen']/a/span", "xpath:idRelative"],
        ["xpath=//tr[3]/td/div/div/a/span", "xpath:position"]
      ],
      "value": ""
    }, {
      "id": "7ee53efd-8b9d-44c2-8fad-9b1544419cff",
      "comment": "",
      "command": "mouseUp",
      "target": "css=#assignedTo_chosen input",
      "targets": [
        ["css=#assignedTo_chosen input", "css:finder"],
        ["xpath=(//input[@type='text'])[5]", "xpath:attributes"],
        ["xpath=//div[@id='assignedTo_chosen']/a/div[2]/input", "xpath:idRelative"],
        ["xpath=//tr[3]/td/div/div/a/div[2]/input", "xpath:position"]
      ],
      "value": ""
    }, {
      "id": "d4201267-c162-4348-a26f-6c806feee9ba",
      "comment": "",
      "command": "click",
      "target": "css=.active-result:nth-child(1)",
      "targets": [
        ["css=.active-result:nth-child(1)", "css:finder"],
        ["xpath=//div[@id='assignedTo_chosen']/div/ul/li", "xpath:idRelative"],
        ["xpath=//tr[3]/td/div/div/div/ul/li", "xpath:position"],
        ["xpath=//li[contains(.,'A:admin')]", "xpath:innerText"]
      ],
      "value": ""
    }, {
      "id": "6bf7a13d-9654-4d57-9f9a-5d855b6999f1",
      "comment": "",
      "command": "type",
      "target": "id=deadline",
      "targets": [],
      "value": "2020-06-06"
    }, {
      "id": "e9920133-be28-434e-b34e-c0420d9d9942",
      "comment": "",
      "command": "store",
      "target": "bug标题 ${index}",
      "targets": [],
      "value": "bugtitle"
    }, {
      "id": "c00e98b7-ab04-4a8d-b4c0-3aba6b930da7",
      "comment": "",
      "command": "store",
      "target": "bug内容${index}:【问题】aaa<br/><br/>【步骤】bbb<br/><br/>【期望】ccc<br/><br/>",
      "targets": [],
      "value": "edtiorcontents"
    }, {
      "id": "5cfc38b8-b186-40cc-8288-0533586927bd",
      "comment": "",
      "command": "type",
      "target": "id=title",
      "targets": [],
      "value": "${bugtitle}"
    }, {
      "id": "284179ae-e222-42f6-a0e3-ae5e1f347790",
      "comment": "",
      "command": "selectFrame",
      "target": "index=1",
      "targets": [],
      "value": ""
    }, {
      "id": "7cc0f9d9-98b9-4a7b-91e1-bd6cab14dfc4",
      "comment": "",
      "command": "click",
      "target": "css=.article-content",
      "targets": [],
      "value": ""
    }, {
      "id": "65d2cd88-0359-45eb-9df9-d598d46fb9bc",
      "comment": "",
      "command": "type",
      "target": "xpath=/html/body",
      "targets": [],
      "value": "${edtiorcontents}"
    }, {
      "id": "917a6008-82bd-44ca-b3df-53b89641b905",
      "comment": "",
      "command": "selectFrame",
      "target": "relative=parent",
      "targets": [],
      "value": ""
    }, {
      "id": "3f1c7394-b30a-441b-adf1-dcb2c1cfcbd4",
      "comment": "",
      "command": "executeScript",
      "target": "editor['steps'].html(${edtiorcontents})",
      "targets": [],
      "value": ""
    }, {
      "id": "b16a9b99-c8db-495b-938e-97b35f78c187",
      "comment": "",
      "command": "executeScript",
      "target": "return document.getElementById(\"steps\").innerHTML=${edtiorcontents}",
      "targets": [],
      "value": ""
    }, {
      "id": "b9d255c4-17ab-4ff5-8419-95d6bda1cd85",
      "comment": "",
      "command": "mouseDown",
      "target": "css=#story_chosen span",
      "targets": [
        ["css=#story_chosen span", "css:finder"],
        ["xpath=//div[@id='story_chosen']/a/span", "xpath:idRelative"],
        ["xpath=//tr[7]/td/span/div/a/span", "xpath:position"]
      ],
      "value": ""
    }, {
      "id": "7e31f2f0-c173-4090-9fa5-27700a115ad1",
      "comment": "",
      "command": "mouseUp",
      "target": "css=#story_chosen input",
      "targets": [
        ["css=#story_chosen input", "css:finder"],
        ["xpath=(//input[@type='text'])[12]", "xpath:attributes"],
        ["xpath=//div[@id='story_chosen']/a/div[2]/input", "xpath:idRelative"],
        ["xpath=//tr[7]/td/span/div/a/div[2]/input", "xpath:position"]
      ],
      "value": ""
    }, {
      "id": "aa03baa1-c195-4931-8186-d1528014f009",
      "comment": "",
      "command": "click",
      "target": "css=#story_chosen .active-result",
      "targets": [
        ["css=#story_chosen .active-result", "css:finder"],
        ["xpath=//div[@id='story_chosen']/div/ul/li", "xpath:idRelative"],
        ["xpath=//span/div/div/ul/li", "xpath:position"],
        ["xpath=//li[contains(.,'1:产品需求1 (优先级:3,预计工时:0)')]", "xpath:innerText"]
      ],
      "value": ""
    }, {
      "id": "74036ff8-63cf-467c-948b-7e7dfa243d70",
      "comment": "",
      "command": "click",
      "target": "css=#mailto_chosen > .chosen-choices",
      "targets": [
        ["css=#mailto_chosen > .chosen-choices", "css:finder"],
        ["xpath=//div[@id='mailto_chosen']/ul", "xpath:idRelative"],
        ["xpath=//tr[8]/td/div/div/ul", "xpath:position"]
      ],
      "value": ""
    }, {
      "id": "dc5fc558-c366-4147-8cf8-a7a486d20df0",
      "comment": "",
      "com
  • 3
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值