程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Most beginners learn Python and web automation. In this way, they learn and give up

編輯:Python



Here's the catalog title


  •  ​ Preface ​​
  •  ​ Rhythm one : A great god , Help me , Help! , It's always uncertain ​​
  •  ​ Rhythm two : I look at the , I've seen all these codes , But how to do this project ​​
  •  ​ Rhythm three : Can't even ask questions ? What else to ask ?​​
  •  ​ Rhythm four : I just want to xxx Language is OK , Other languages don't need ​​
  •  ​ Principle one : Ability makes it ​​
  •  ​ Principle two : The same should change ​​
  •  ​ Principle three : Unite all forces that can be united ​​
  •  ​ Principle four : Show the results ​​
  •  ​ Principle 5 : Maintainable code ​​


Preface

For many years , I've done a lot of projects , There are successes and failures , But the failure rate of automated testing projects is undoubtedly the highest . in the course of time , Then we can gradually sum up a rhythm of automatic test death .

Rhythm one : A great god , Help me , Help! , It's always uncertain

In this sentence, I often see , First time to see , I'll teach you how to solve this problem . But a few days later , Similar problems arise , You still can't solve it . Because you don't understand the principle

First , The great God is very busy . Some great gods are willing to share , They contributed a lot of information , however , You don't check , You don't see , You always think " Ask shamelessly " The most direct , But the great God helps you solve problems and increases your inertia and dependence , As a result, you are making slow progress , I've never been confident , Later, there were too many problems , Give up directly .

Don't be afraid of problems , Search the Internet , Many people will encounter the same problem , Let's take a look at how others solved it , Then draw inferences from others , Not only did it solve the problem , And you can make progress , This is the right way .

Then someone asked me a question , My general answer is " Search the Internet XXXX", It's not that I don't want to help you , I'm teaching you , Whatever you do , In the end, you can only rely on yourself .

Generally, people who encounter this rhythm may not have strong learning ability , If automated testing is left to these people , Then death can be expected .

Improve your learning ability and error correction ability , Don't panic , There is a better way to solve the problem , Hold the line , Improve slowly , Slowly improve yourself , That's it .

Rhythm two : I look at the , I've seen all these codes , But how to do this project

I recommended that they read a good study book , Tell them to type the code in the book carefully , People have repeatedly asked me the questions mentioned in my book , My answer is always :“ Have you typed these codes ?”, answer :“ no , But I've seen it ”. I can only laugh and cry about it , Seeing it doesn't mean doing it , Automated test projects are code practice , You can't learn to pile code just by looking at it without writing it . therefore , On the project , Be sure to do more , Don't just collect other people's opinions , such as " Do you think my project is suitable for Automation ?", “ What tools should I use for Automation ?”, Others are always bystanders , Only the result of your own experiment is accurate , Don't take other people's opinions as edicts and proverbs , Practice is the first priority .

For automated testing , My understanding is to type the code first . If a tool or code can't be mastered easily , So it should be difficult to start the project . also , Write more code yourself , Understand more error tips , There are many problems that you can realize by yourself , Don't ask others when you have a little problem , Not only won't others help you , Maybe I will despise you , Really? , I've been despised before .

Seeing it doesn't mean doing it , That's important . Even if you've seen all the first-line actress movies on the island , But if not , You're still a poor virgin , There is no chance of counter attack .

Rhythm three : Can't even ask questions ? What else to ask ?

This is too concise . I'd love to help you , But before I help you, I'll ask a string of :“ What tools are you using , What operating system , What kind of programming language ”, Yes, of course , This is when I'm in a good mood , Sometimes I feel bad , Pull black directly , The whole world is quiet . Asking questions is artistic , Describe the problem clearly , Someone else can help you , Or no one will talk to you . Then you feel neglected , Then you're sad , Then you make complaints about it , Then you can't make complaints about it , Finally you gave up . The same rhythm of death . Actually , As long as you describe the problem clearly , Then search the Internet , You can basically get the answer . remember ,google It's your best friend , The great God is not .

Rhythm four : I just want to xxx Language is OK , Other languages don't need

In theory, this is correct , But language is still a tool , When doing a very complicated thing , A single tool is often difficult to complete the task well . Any language has its good part , What you're not good at , Learning from each other is the king way . I've used a lot of languages , But at the front end UI When automating , I find ruby+watir webdriver Very convenient , So I always use , The project has been doing , I haven't failed for years . But if it was java Words , I guess our product will be revised several times , The automation project is coming to an end . There's no harm in learning more languages , But if you choose to focus , Then you have your reason , You can insist on , No one will blame you .

Said so much about the rhythm of death , Now let's briefly summarize what automation should do .

Principle one : Ability makes it

This ability refers to the comprehensive ability of . First you have to be able to test , Automated testing is, after all, writing use cases in code . Second, you should be able to write code , You have to translate use cases into code . Don't be superstitious about recording and playback tools , It's basically impossible to do a project with this alone . And it doesn't make sense for you to record and replay , Anyone who studies one day will learn to record and play back . Doing automated testing is actually a good improvement of your ability , We must seize this opportunity , Don't make a recording and playback without any technical content , What's the use of learning , Everyone will record , Why should you record .

Automated testing is actually very difficult , There will be many difficulties , After all, the front end UI Things are the easiest to change , But if you're strong enough , There is always a way for you to overcome these variables . such as UI Always change , You can encapsulate some page object Thought , Give Way UI It's easier to modify . And use cases always make mistakes , It's better to add automatic screenshots to the code , You can locate the problem at a glance , Code maintenance is naturally much easier .

There is never a successful automation project that a rookie can do successfully , When you succeed in a project , You naturally become an expert from a rookie .

Principle two : The same should change

UI Always changing , Than the monkey king . But in the process of change, there must be something unchanged , When we do automated testing, we should try to use these constant things . For example, form elements name, It usually doesn't change frequently , Relatively stable . In addition, the data will change , For example, you enter a work order list page , Sometimes 10 Data , Sometimes 20 strip . Sometimes the first piece of data is A, Sometimes it's B, This is because the data is changing , At this time, you just need to keep the data fixed , After entering the work order list, there must be only 10 Data , The first data is always A, Then your use cases are naturally refreshing to write , It's not very difficult , It's also easy to maintain .

Principle three : Unite all forces that can be united

For me, , Many times I'm always fighting alone . Development efforts to change an iteration , Several new functions and bug, Then I update the corresponding automation use case . Because my framework has good scalability , So the development changed to two weeks UI, I can finish it in two days , But if I'm always changing alone , Then I must be very lonely . At this time, let the manual tester help me change , Automation is a blessing for them , Can save its return time , So it's necessary for them to use the example , Then I taught them how to change , When they learn, I can let go of other things . Now I basically don't do Automation , That's why , Someone helped me do , And more motivated than me to do .

Principle four : Show the results

I specially wrote a report platform to display automated test reports . Be sure to let team members know what you're doing , Reporting is the easiest way . A successful project must have a good report , There's no doubt about that .

Principle 5 : Maintainable code

The code should be easy to read , Easy to change . Look at what I wrote lazyman The sample code in the framework , Look at the original webdriver Code , You should feel something . remember , Native webdriver The code must be hard to maintain , No framework support and encapsulation , Native webdriver Code is generally difficult to scale , It's hard to reach the scale of hundreds of use cases . A good framework can make you get twice the result with half the effort , Don't be obsessed with native code , It can be used , But not enough .

If the software is tested 、 The interface test 、 automated testing 、 Technology peers 、 Continuous integration 、 Interview experience exchange . If you are interested, you can go to 893694563, There will be test data sharing within the group from time to time .

If it helps you , Please give me a hand to make a fortune , Thank you for your support , Your praise is my motivation for continuous updating .




  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved