当前位置:网站首页>2 days, using 4 hours after work to develop a test tool

2 days, using 4 hours after work to develop a test tool

2020-11-08 09:45:00 I'm sorry.

 

Source code and installation package :

git route :https://github.com/yzxwp/test_Autotool.git

Installation package download : link :https://pan.baidu.com/s/1w6AeBx2I1d9FZDxR6rcuMw Extraction code :GGMM

Development reasons :

Now I'm mainly engaged in the testing of auto finance projects , Colleagues around me told me , The test data is hard to build , For example, the ID number , Unified social credit code , Vehicle frame number and other data verification is complex , Direct access to data in the database involves information that can be , After desensitization, the data may not be available , Online generation tools are not available due to network permissions , There are colleagues who have access to the Internet , But these websites sometimes don't know why they will be closed for a period of time , So it can take a long time to make a piece of data , In order to improve the test efficiency and quality , Avoid wasting valuable testing time on manufacturing data , So I combine the number generation rules on the Internet , For the existing method implementation directly cv Dafa , If not, I wrote it myself , Write this small program to automatically generate test data .

Usage method :

 take exe Download the file ,git And Baidu cloud can , Put them on the desktop or in the right path .
 Then double click to open .

 Click on the right to retrieve the data , You can get new data in the text box , Click the bottom to retrieve all the data , You can refresh all the data .

  I used to do back-end development , I don't know much about front-end technology , After watching it all afternoon tkinter, I write about disability GUI page , I hope you can criticize and correct .

class demo():
    def __init__(self):
        self.root = Tk()
        self.root.title(" Auto generate test data widget ")  #  Set the window title 
        # self.root.attributes("-toolwindow", 1)
        dd.center_window(self.root, 340, 280)
        self.way()

    def way(self):
        # refresh all 
        Button(self.root, text=' Recapture all the data :', command=self.text_all).grid(row=8, column=2, sticky=W)

        #  User name 
        self.lab_name = Label(self.root, text=' use   Household    surname   name  :').grid(row=0, column=1)
        self.text_name = Text(self.root, height=1, width=20)
        self.text_name.insert('0.0', name.random_name())
        self.text_name.grid(row=0, column=2, sticky=W)
        self.text_name_click = Button(self.root, text=' Recapture :',command=self.text_name1).grid(row=0, column=3, sticky=W)

        #  Phone number 
        self.lab_phone = Label(self.root, text=' hand   machine    Number   code  :').grid(row=1, column=1)
        self.text_phone = Text(self.root, height=1, width=20)
        self.text_phone.insert('0.0', phone.phone_num())
        self.text_phone.grid(row=1, column=2, sticky=W)
        self.text_phone_click = Button(self.root, text=' Recapture :',command=self.text_phone1).grid(row=1, column=3, sticky=W)

        #  Id card number 
        self.lab_idcard = Label(self.root, text=' body   Share   Prove   Number   code  :').grid(row=2, column=1)
        self.text_idcard = Text(self.root, height=1, width=20)
        self.text_idcard.insert('0.0', id_card.main())
        self.text_idcard.grid(row=2, column=2, sticky=W)
        self.text_idcard_click = Button(self.root, text=' Recapture :',command=self.text_idcard1).grid(row=2, column=3, sticky=W)

        #  Unified social credit code 
        self.lab_tyshzxm = Label(self.root, text=' Unified social credit code :').grid(row=3, column=1)
        self.text_tyshzxm = Text(self.root, height=1, width=20)
        self.text_tyshzxm.insert('0.0', id_credit.create_social_credit())
        self.text_tyshzxm.grid(row=3, column=2, sticky=W)
        self.text_tyshzxm_click = Button(self.root, text=' Recapture :',command=self.text_tyshzxm1).grid(row=3, column=3, sticky=W)

        #  Organization code 
        self.lab_zzjgdm = Label(self.root, text=' organization   Institutions   Code :').grid(row=4, column=1)
        self.text_zzjgdm = Text(self.root, height=1, width=20)
        self.text_zzjgdm.insert('0.0', id_credit.create_organization())
        self.text_zzjgdm.grid(row=4, column=2, sticky=W)
        self.text_zzjgdm_click = Button(self.root, text=' Recapture :',command=self.text_zzjgdm1).grid(row=4, column=3, sticky=W)

        # Get the frame number at random 
        self.lab_vin = Label(self.root, text=' vehicle   Frame   Number :').grid(row=5, column=1)
        self.text_vin = Text(self.root, height=1, width=20)
        self.text_vin.insert('0.0', vin.random_vin())
        self.text_vin.grid(row=5, column=2, sticky=W)
        self.text_vin_click = Button(self.root, text=' Recapture :',command=self.text_vin1).grid(row=5, column=3, sticky=W)

        #  Get the bank card of ICBC at random 
        self.lab_bank_gon = Label(self.root, text=' ICBC   Bank card number :').grid(row=6, column=1)
        self.text_bank_gon = Text(self.root, height=1, width=20)
        self.text_bank_gon.insert('0.0', bank_card.gen_bank_card_nonghang())
        self.text_bank_gon.grid(row=6, column=2, sticky=W)
        self.text_bank_gon_click = Button(self.root, text=' Recapture :',command=self.text_bank_gon1).grid(row=6, column=3, sticky=W)

        #  Get ABC bank card at random 
        self.lab_bank_non = Label(self.root, text=' ABC   Bank card number :').grid(row=7, column=1)
        self.text_bank_non = Text(self.root, height=1, width=20)
        self.text_bank_non.insert('0.0', bank_card.gen_bank_card_gonghang())
        self.text_bank_non.grid(row=7, column=2, sticky=W)
        self.text_bank_non_click = Button(self.root, text=' Recapture :',command=self.text_bank_non1).grid(row=7, column=3, sticky=W)

        self.root.mainloop()

    def text_name1(self):
        self.text_name.delete('0.0', END)
        self.text_name.insert('0.0', name.random_name())

    def text_phone1(self):
        self.text_phone.delete('0.0', END)
        self.text_phone.insert('0.0', phone.phone_num())

    def text_idcard1(self):
        self.text_idcard.delete('0.0', END)
        self.text_idcard.insert('0.0',id_card.main())

    def  text_tyshzxm1(self):
        self.text_tyshzxm.delete('0.0', END)
        self.text_tyshzxm.insert('0.0', id_credit.create_social_credit())

    def text_zzjgdm1(self):
        self.text_zzjgdm.delete('0.0', END)
        self.text_zzjgdm.insert('0.0', id_credit.create_organization())

    def text_vin1(self):
        self.text_vin.delete('0.0', END)
        self.text_vin.insert('0.0', vin.random_vin())

    def text_bank_gon1(self):
        self.text_bank_gon.delete('0.0', END)
        self.text_bank_gon.insert('0.0', bank_card.gen_bank_card_gonghang())

    def text_bank_non1(self):
        self.text_bank_non.delete('0.0', END)
        self.text_bank_non.insert('0.0', bank_card.gen_bank_card_nonghang())

    def text_all(self):
            self.text_name.delete('0.0', END)
            self.text_name.insert('0.0', name.random_name())
            self.text_phone.delete('0.0', END)
            self.text_phone.insert('0.0', phone.phone_num())
            self.text_idcard.delete('0.0', END)
            self.text_idcard.insert('0.0', id_card.main())
            self.text_tyshzxm.delete('0.0', END)
            self.text_tyshzxm.insert('0.0', id_credit.create_social_credit())
            self.text_zzjgdm.delete('0.0', END)
            self.text_zzjgdm.insert('0.0', id_credit.create_organization())
            self.text_vin.delete('0.0', END)
            self.text_vin.insert('0.0', vin.random_vin())
            self.text_bank_gon.delete('0.0', END)
            self.text_bank_gon.insert('0.0', bank_card.gen_bank_card_gonghang())
            self.text_bank_non.delete('0.0', END)
            self.text_bank_non.insert('0.0', bank_card.gen_bank_card_nonghang())

This gadget is already in use , It has been highly praised by colleagues , It greatly saves the time of colleagues . Follow up optimization is ready , Recently, I collected suggestions from my colleagues , Add some data , for example : Middle signature code , The card numbers of the other three of the five banks .

I will develop one later monkey Gadgets , Can automatically generate monkey command , Get the phone automatically devices Etc ,

版权声明
本文为[I'm sorry.]所创,转载请带上原文链接,感谢