UI automated testing - Jenkins configuration

Some time ago, I helped the team build a UI automation environment. Here I will share with you some configurations of the Jenkins environment.

Background:
One of the team’s goals in the second half of the year is to implement automated testing. Here I want to complain about the test platform developed before. The original purpose was to do automated interface testing. and performance testing, but due to various reasons, the interface automated testing function has been completely abandoned, which has a lot to do with ease of use. In addition, it is also related to our company's interface business. However, the developers of the performance testing function are very happy to use it, as well as the management of the interface. It is currently an important bridge connecting the front end and the back end. Currently, environment management has been added (my company mainly uses docker to create development and testing environments). Recently, demand management and bug management have been added. Therefore, it has changed from a "test platform" to a "R&D collaboration platform". Why not use the mainstream defect management system on the market? For example, ZenTao, JIRA. Because our company has its own specific development process. The platforms on the market alone cannot satisfy environmental management (docker).

When it comes to automated testing, of course the priority is interface automation. I have also shared a comparison of mainstream interface tools/frameworks before, but after actually communicating with test students in the business line, I found that the payment interface is asynchronous and the gateway is also Not sure, it turns out to be hard to do. In addition, the businesses tested are interrelated. There are more than a dozen interfaces involved in the process from selecting activities, adding shopping carts, and paying, all of which are highly dependent on the return value of the previous interface. It makes little sense to test a single interface if you remove dependencies (use mockServer), and it cannot cover existing business scenarios.

So, we gave up on automated interface testing and started with the UI first, which was easier to do and just simulate the user's operation process. Therefore, interface automation is not necessarily easier to do than UI automation. It depends on the project.

Technology used in UI automation:
selenium: No explanation.

pytest: Unit testing framework, because it can globally configure the opening and closing of browser drivers, and has many useful extension plug-ins, which is more suitable for UI automation.

pytest-html: Generates HTML test reports, and can configure automatic screenshots when use cases fail, which is important for UI automation.

pytest-rerunfailures: It can realize the failed rerun of use cases, which is also important for UI automation. Selenium-page-objects: The page objects library I encapsulated has been introduced before, making it easier for you to write the page layer.

Git/Bitbucket: Our test code is submitted to Bitbucket for management.

现在我也找了很多测试的朋友,做了一个分享技术的交流群,共享了很多我们收集的技术文档和视频教程。
如果你不想再体验自学时找不到资源,没人解答问题,坚持几天便放弃的感受
可以加入我们一起交流。而且还有很多在自动化,性能,安全,测试开发等等方面有一定建树的技术大牛
分享他们的经验,还会分享很多直播讲座和技术沙龙
可以免费学习!划重点!开源的!!!
qq群号:822269834

What does Jenkin do?

The next step is the focus. Jenkins is mainly used to runUI automated tests. Next, I will introduce my configuration.

Configure Git, connect to Bitbucket, and check for project code updates.

 Scheduled tasks are set to run at 22:00 every night.

Build command, pull the code, and run all use cases.

 Set the path of the HTML test report

Set the path to the XML test report.

 Configure the email function.

The approximate effect is as follows:

You can click HTML Report to view the HTML report, and the latest results can be seen in the project XML format report. Test the trend chart, which is generated based on the XML report plug-in.

View the test HTML test report in Jenkins.

And, of course, the email you receive when the build is complete.

 I hope the above introduction can provide you with some ideas.

Summarize:

Thank you to everyone who reads my article carefully! ! !

As someone who has experienced it, I also hope that everyone will avoid some detours. If you don’t want to experience the feeling of not being able to find information, no one to answer questions, and giving up after persisting for a few days while studying, here I will share with you some learning about automated testing. Resources, I hope they can help you on your way forward

Software Testing Interview Document

We must study to find a high-paying job. The following interview questions are from the latest interview materials from first-tier Internet companies such as Alibaba, Tencent, Byte, etc., and some Byte bosses have given authoritative answers. After finishing this set I believe everyone can find a satisfactory job based on the interview information.

 

 

Guess you like

Origin blog.csdn.net/2301_79535733/article/details/134998036