Test Automation: java + selenium3 UI Automation (1) - built environment

1 Introduction

I probably was in 2012 the first official contact with the automated testing, at that time to follow my team together, they UI Automation attempt was made to explore the project.
When I left the company, our automated test system is still hardly perfect, but it has reached a very high efficiency level. Our testing department from a purely manual testing team to the business, but also the transition to automation: manual = 2: 1 team structure.
Today, the fiery test of the degree of automation compared to the year rose again several levels, for test engineers, test automation technology and grasp the idea, undoubtedly personal importance to the technical road. So I am going to spend a certain amount of space, the new scratch for java + selenium3 this automated system to record and resolve some, be a self-related technologies precipitation. Also we hope to provide some guidance and help of friends new to this area.

2. Introduction of small automation system

Allow me to take a little space to introduce the mainstream market, automated testing system now.
Aside "generalized" do not say automated, today mainly in the direction of the test automation "UI" layer "API" layer, i.e. a so-called UI automation and automated interfaces, as shown below:
Test pyramid
UI Automation advantages:

  • Test achieved by simulating a user operation
  • Close to the products and services to facilitate the validation and acceptance

Its disadvantages (mainly contrast automation API):

  • Large amount of code maintenance workload
  • Vulnerable to changes

Especially this first point, leading to UI Automation been criticized by a number of people and businesses, and even lead to a series of disputes.
But the actual project, there is no UI Automation is sad to say, there are quite a number of projects still choose to use UI automated way to enhance the efficiency of the test. We do expect this series to a total collection of UI Automation, as API automated follow-up might do the same a summary.

The purpose of writing this paragraph, for the novice in terms of automation, UI Automation is definitely not a piece of technology that you can not, it can be said start.

3, built environment

Based on the beginning of the UI Automation java + selenium, the first step is to build the environment, we need the following things:

  • JDK: of course, have to write java code java development kit
  • Eclipse: java programming environment inherited
  • Selenium: UI automation backbone
  • All kinds of browsers driver: a bridge between Selenium3 era, browser and automation.

We may have to follow to join components and frameworks such as testNG, maven, etc., this may need to do the follow-up. To write code and debug automation initial success, only the four things on it.

3.1 JDK

Oracle is recommended to download the official website:
https://www.oracle.com/technetwork/java/javase/downloads/index.html

Installation configuration process a large number of online tutorials, not repeat them here.

3.2 Eclipse

Eclipse also recommended to the official website to download:
https://www.eclipse.org/downloads/

Installed the JDK, then, eclipse installation should be no problem.

3.3 Selenium

If you are using maven management, it may need similar selenium and other libraries can use to manage and download maven. For learning purposes, here we do not use maven management, but to manually download him.
Recommend selenium go to the official website to download, the address is: https://www.seleniumhq.org/download/ :

You can choose to download the latest version or the version of history:
Here Insert Picture Description

4. The browser driver

Go to https://www.seleniumhq.org/download/ ,
the next turn browsers driver download area, select the corresponding need to test drive a browser:
(This article will relate to Firefox and Chrome, it is required under the red arrow chart It refers to two drives)
Here Insert Picture Description

The alternate download address

If the above Problems with the download, you can get the network disk to the following resources:

Links: https://pan.baidu.com/s/1yWZg22kQJQ0z_G8tJJnjXA
extraction code: d19c

4. Project Configuration

Open eclipse, create a java project, named seleniumTest, other options remain the default is complete.
Create a new folder lib, we need to place the library, built in the future will be the preamble to download a copy of selenium jar package uses past, F5 to refresh the project:
Here Insert Picture Description
to create another folder tools, used to place the driver file browser, operating the same as above:
Here Insert Picture Description
right project, select the build path - configure build path - Libraries - Add Jars, select lib folder below the selenium jar package.
Here Insert Picture Description
After completion of the initial java + selenium environment to build finished.

Next Be the first selenium codes, launch a browser


Software testing exchange group: 717 380 210
There are software testing, automated testing, testing for safety-related issues need to explore the exchange of small partners are welcome to join!

Guess you like

Origin www.cnblogs.com/dayu2019/p/11313602.html