Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Practice of automatic functional testing

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

My blog address: https://www.peretang.com/automated-functional-testing-in-action/

Development tools

IntelliJ IDEA / Eclipse

Apache Maven

Java JDK 8

Development framework

JUnit

Selenium WebDriver

Realization principle

Use Selenium WebDriver API to write functional test cases, use JUnit to be responsible for unit test basic configuration, and use Maven tools to help manage project dependencies

Demonstration code

Github

Operation steps

1. Create a Maven project

two。 Add Selenium dependency, because Selenium also depends on Junit, so JUnit dependency will be passed, and we don't have to declare our dependence on JUnit.

3. Download the corresponding WebDriver file, and we use the Chrome browser in our example, so we download the WebDriver file of Chrome [1]

4. Put the WebDriver file in the project path to facilitate the unified environment and use of the project.

5. Create a new test base class to set some common configurations and initialize the WebDriver object

6. Create a new test case, inherit the test base class, and then write the test logic

7. When you perform the test, you will see that Selenium automatically helps us open the Chrome browser and perform the operation according to the logic of our code

Referenc

[1]: Selenium wiki page

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report