Ant + JUnit test automation

zhaozj2021-02-16  44

With the extensive promotion of Refactoring technology and XP software engineering technology, the role of unit testing is increasingly important in software engineering, and a concise cyclic, wide, efficient and stable unit test framework has a successful implementation unit test. critical use. In the Java programming statement environment, Junit Framework is an excellent test framework that has been adopted and empirically used by most Java programmers, but most of the number of programs that do not try JUnit Framework are learning how JUnit Framework is to write unit tests that adapt to their own development projects. I still feel that there is a certain difficulty, which may be because JUnit has the user guide and documentation with the framework code and utility with a focus on explaining the design method of the unit test framework and a simple type of use instructions, while the framework is in a specific test framework. Under how to implement unit testing, how to update and maintain existing unit test code during project development has not been explained in detail. Therefore, this document has further supplemented and description of the documentation attached to JUnit, so that JUnit can be used by more development teams, allowing unit testing and even refactoring, XP technology better in more development teams .

This article will showcase the overall testing method in the code method, and generate test reports to the developer's mailbox

Place junit.jar under ANT_HOME / LIB and write build.xml files

Build.xml

Depends = "CompileTest, Run"> < / fileset> After generating test reports, call the Emai.bat file and execute a mail action. In order to realize the group, I use it to send an email, of course, you can also send mail directly with Ant. Programmer's No. 7 has related articles introduced, I will not say much here.

This article provides a thinking, you can also achieve more powerful features, distribution test overall testing, etc.

转载请注明原文地址:https://www.9cbs.com/read-25285.html

New Post(0)