公海710登录网址V1:RegUserModel

#-*- coding:UTF-8 -*-
__author__ = 'poptest'
import time
import unittest
from selenium import webdriver

class RegUserModel(unittest.TestCase):
    def setUp (self):
        global drive
        #打开火狐浏览器
        drive = webdriver.Firefox()
        #窗口最大化,显示所有对象
        drive.maximize_window()
        #设置地址栏
        drive.get("http://192.168.114.139/Tinyshop/")

    def tearDown(self):

        drive.quit()


    def testRegUser001(self):
        drive.find_element_by_xpath(".//*[@id='header']/div[1]/div/ul/li[2]/a").click()
        drive.find_element_by_xpath(".//*[@id='email']").send_keys("123351913159@qq.com")
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[2]/dd/input").send_keys("111111")
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[3]/dd/input").send_keys("111111")
        drive.find_element_by_xpath(".//*[@id='readme']").click()
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[6]/dd/input").click()
        time.sleep(3)
        #实际结果
        actValue = drive.find_element_by_xpath(".//*[@id='content']/div/div/div[1]").text
        #断言
        self.assertEqual(actValue,u"恭喜您,注册成功!")


    def testRegUser002(self):
        drive.find_element_by_xpath(".//*[@id='header']/div[1]/div/ul/li[2]/a").click()
        drive.find_element_by_xpath(".//*[@id='email']").send_keys("123534258743@qq.com")
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[2]/dd/input").send_keys("111111")
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[3]/dd/input").send_keys("111111")
        drive.find_element_by_xpath(".//*[@id='readme']").click()
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[6]/dd/input").click()
        time.sleep(3)
        #实际结果
        actValue = drive.find_element_by_xpath(".//*[@id='content']/div/div/div[1]").text
        #断言
        self.assertEqual(actValue,u"恭喜您,注册成功!")

    def testRegUser003(self):
        drive.find_element_by_xpath(".//*[@id='header']/div[1]/div/ul/li[2]/a").click()
        drive.find_element_by_xpath(".//*[@id='email']").send_keys("1233455425412233@qq.com")
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[2]/dd/input").send_keys("111111")
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[3]/dd/input").send_keys("111111")
        drive.find_element_by_xpath(".//*[@id='readme']").click()
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[6]/dd/input").click()
        time.sleep(3)
        #实际结果
        actValue = drive.find_element_by_xpath(".//*[@id='content']/div/div/div[1]").text
        #断言
        self.assertEqual(actValue,u"恭喜您,注册成功!")

    def testRegUser004(self):

        drive.find_element_by_xpath(".//*[@id='header']/div[1]/div/ul/li[2]/a").click()
        drive.find_element_by_xpath(".//*[@id='email']").send_keys()
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[2]/dd/input").send_keys("111111")
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[3]/dd/input").send_keys("111111")
        drive.find_element_by_xpath(".//*[@id='readme']").click()
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[6]/dd/input").click()
        time.sleep(3)
        #实际结果
        actValue = drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[1]/dd/label").text
        #断言
        self.assertEqual(actValue,u"邮箱(例如:demo@tinyx.com)")

    def testRegUser005(self):
        drive.find_element_by_xpath(".//*[@id='header']/div[1]/div/ul/li[2]/a").click()
        drive.find_element_by_xpath(".//*[@id='email']").send_keys("1245612423@qq.com")
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[2]/dd/input").send_keys("11111")
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[3]/dd/input").send_keys("111111")
        drive.find_element_by_xpath(".//*[@id='readme']").click()
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[6]/dd/input").click()
        time.sleep(3)
        #实际结果
        actValue = drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[2]/dd/label").text
        #断言
        self.assertEqual(actValue,u"6-20任意字符组合")
    def testRegUser006(self):
        drive.find_element_by_xpath(".//*[@id='header']/div[1]/div/ul/li[2]/a").click()
        drive.find_element_by_xpath(".//*[@id='email']").send_keys("pop2351@126.com")
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[2]/dd/input").send_keys("111111")
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[3]/dd/input").send_keys("11111")
        drive.find_element_by_xpath(".//*[@id='readme']").click()
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[6]/dd/input").click()
        time.sleep(3)
        #实际结果
        actValue = drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[3]/dd/label").text
        #断言
        self.assertEqual(actValue,u"6-20任意字符组合")


    def testRegUser007(self):
        drive.find_element_by_xpath(".//*[@id='header']/div[1]/div/ul/li[2]/a").click()
        drive.find_element_by_xpath(".//*[@id='email']").send_keys("2@.com")
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[2]/dd/input").send_keys("111111")
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[3]/dd/input").send_keys("111111")
        drive.find_element_by_xpath(".//*[@id='readme']").click()
        drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[6]/dd/input").click()
        time.sleep(3)
        #实际结果
        actValue = drive.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/form/dl[1]/dd/label").text
        #断言
        self.assertEqual(actValue,u"邮箱(例如:demo@tinyx.com)")

#全部跑、固定格式
unittest.main()


#跑指定case,封装测试套
#声明一个列表(将需要测试的case加入到caselist中)
#caselist=("testReguser2","testReguser7")
#声明一个测试套
#regSuite=unittest.TestCase()
#循环case,找到要测试的用例
#for tmpcase in caselist:
    #往测试套里添加用例(类,取值)
   # regSuite.addTest(RegUserModel(tmpcase))
#执行测试套
#unittest.TextTestRunner().run(regSuite)

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图