• 课后作业3

    import pytest
    from selenium import webdriver
    from selenium.webdriver.common.by import By
    import random

    class TestDefaultSuite():
    def setup_method(self, method):
    options = webdriver.ChromeOptions()
    options.debugger_address = '127.0.0.1:9000'
    self.driver = webdriver.Chrome()
    self.driver.implicitly_wait(5)
    self.driver.maximize_window()
    self.vars = {}

    def teardown_method(self, method):
    self.driver.quit()

    # testcase02: 企业微信自动添加成员,需要复用已经登录的chrome,需要debugger address
    def test_addpartner(self):
    url = 'https://work.weixin.qq.com/wework_admin/frame#contacts'
    self.driver.get(url)

    # 通过cookie登录
    cookies = {
    "wwrtx.vst": "bSwvqnvSpnN2uENJ8Xb3ZEqrkw7Omzx_VXiXWrmrWahdQvmhWMazZJ9iswGFXohewurgONuvcwW_Ur5FADGPVjykm584AlqytGZDvpszGXbroxdP4DBLUvEjTXoBjR8qEq_o0-7jBe9QQsDWinwXOFH9TdS7bSPTFJ7mbx6fig6bXcH_bHpSCRP9TMZLn4UrxovVC4wOUB8U2o1MqkziTCW0wCfiglffp-J-X9eRytNPvklOJGKsazC-vX31ASw4V7O0agkgNHR97RpU23eMJg",
    "wwrtx.d2st": "a140387",
    "wwrtx.sid": "fqanLJoh8Z1qSPy991xQyxZTzDyNs8AqNiokEOp_pITuBawZhzdpWB1XjnuVIdL5",
    "wwrtx.ltype": "1",
    "wxpay.corpid": "1970325002096061",
    "wxpay.vid": "1688852666103698",
    }
    for k, v in cookies.items():
    self.driver.add_cookie({"name": k, "value": v})
    self.driver.get(url)
    # 点击"添加联系人"
    self.driver.find_element(By.CSS_SELECTOR, 'div > div.member_colRight > div > div.js_party_info > div.js_has_member > div.js_operationBar_footer.ww_operationBar > a.qui_btn.ww_btn.js_add_member').click()
    # 点击姓名输入框
    self.driver.find_element(By.CSS_SELECTOR, '#username')
    # 输入姓名
    memberName = "测试"+ str(random.randint(1000,99999))
    self.driver.find_element(By.CSS_SELECTOR, '#username').send_keys(memberName)
    # 输入别名
    otherName = str(random.randint(10000000,99999999))
    self.driver.find_element(By.CSS_SELECTOR, '#memberAdd_acctid').send_keys(otherName)
    # 输入手机号
    mobile = str(random.randint(18000000000,18099999999))
    self.driver.find_element(By.XPATH, '//*[@id="memberAdd_phone"]').send_keys(mobile)
    # 滑动到页面底部
    js = "window.scrollTo(0,document.body.scrollHeight)"
    self.driver.execute_script(js)
    # 点击保存
    self.driver.find_element(By.CSS_SELECTOR, 'div > div.member_colRight > div > div:nth-child(4) > div > form > div:nth-child(3) > a.qui_btn.ww_btn.ww_btn_Blue.js_btn_continue').click()

    • 课间作业1
    curl 'https://testerhome.com/' | grep title | wc -l
  • 也可以从流程上优化,开发自测+测试验证+产品UAT+生产验证,大家一起参与,一起把好质量关。对于线上出现的漏侧场景,及时反思总结,看是没有分析到位还是执行层面没有把控好,如果是没分析到位,那就追加到测试用例,几个版本积累下来,肯定会越做越完善。然后将全量的测试用例抽取主流程,整理出发版验证checklist,每次发版前按照checklist一条一条执行,坚持下去,相信质量会越来越好