TestNG Official Document Chinese version (1)-Introduction

Source: Internet
Author: User
Tags testng

Recently decided to start using testng instead of JUnit as a future unit Test base component.

For the official documents of TESTNG, please see:

1. Introduce

TESTNG is a test framework designed to simplify a wide range of test requirements, from unit tests (one class for isolation tests) to integration testing (testing the entire system consisting of multiple packages or even multiple external frameworks, such as the use of servers).

The process of writing a test has three typical steps:

* Write the business logic of the test and insert the testng annotation in the code

* Add test information to testng.xml file or Build.xml

* Run testng

You can find a quick Start sample on the Welcome page.

The following are the concepts used in this document:

* The suite is described by an XML file. It contains one or more tests and is defined as a <suite> tag

* Test is described by <test> and contains one or more testng classes

* The TestNG class is a Java class that contains at least one testng annotation, described by the <class> tag and contains one or more test methods

* Test method is a Java method with @testd annotations in the source file

TESTNG testing can be configured @beforexxx and @AfterXXX annotations, allowing some Java logic to be executed before and after a specific point, which is listed above.

The remainder of the handbook will cover the following topics:

* All annotation lists with a short description that provide references to TestNG's multiple functionality, you may need to refer to the code snippets provided for each annotation to learn the details.

* Testng.xml file description, its syntax and if it is specified.

* Detailed list of multiple features and how to use them in conjunction with annotation and testng.xml

*************************************************************************** ****

Note: The above is very short, but please note some of the details.

1.TestNG is a test framework designed to simplify a wide range of test requirements, from unit testing to integration testing

This is the starting point for testng design, not just unit testing, but also for integration testing. The different design goals, compared to JUnit's only for unit testing, testng undoubtedly went further.

Can be used for integration testing, which is the most important reason for me to choose TestNG.

2. The three typical steps of the test process, note that compared to JUnit (4.0), one additional test information is added to the Testng.xml file or Build.xml

Test information, especially test data, is no longer written dead in the test code, the advantage is that modifying the test data does not require modification of the Code/compilation, which helps to introduce testers into unit test/integration testing.

3. The basic concept, compared to JUnit's testcase/testsuite,testng, has suite/test/test method three levels, the Test/test method will be clearly distinguished from the open.

The testcase in JUnit mixes Test/test method, which makes it easier to get people's concepts unclear, especially for beginners.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.