background
Use TestNG to write the test cases, through the @test to execute the use case, the general local through the IDE to execute the corresponding method, continuous integration, all through Maven to execute or specify Testng.xml execution, but if you want to execute the test case through interface/interface.
Steps
TestNG actually provides two ways to do this through code.
1. Execute by class, show t
. What is testng?
TESTNG is defined by its documentation as:
TESTNG is a test framework that is inspired by JUnit and NUnit, but introduces some new features that make it more powerful and easier to use.
TestNG is an open source automation testing framework; TestNG represent
Download Reporter.jar,velocity-dep-1.4.jar and Guice.jar;
Configuration Item Property: Properties->testng->disable Default Listener selected;
Add the listener tag to the XML file:
class-name= "Org.uncommons.reportng.HTMLReporter" > Class-name= "Org.uncommons.reportng.JUnitXMLReporter" >4. Running the project: Run as TestNG Suite5. Operation Result:Test-ouput directory refresh, generate a new HTM
In the traditional way, the test method in JUnit 3 is to test its own name prefix. Marking some methods in a class has special significance. This is a very effective method, but the name is not well extended (if we want to add more labels for different frameworks ?), Rather than lack of flexibility (if we want to pass the additional parameter testing framework ).
The annotation is officially added to the Java language and testng in JDK 5 to make a cho
1. If you want to add a class
Public static void main (string ARGs []) {Testng TNG = new testng ();TNG. settestclasses (new class [] {mytest. Class}) // you can add multiple classes here.TNG. Run ();
}
2. If you have written the test suite XML, use the following method:
Public static void main (string ARGs []) {Testng TNG = new
Architecture
This framework is created using ant, testng and selenium.Through this framework, a user is able to create an automatic test case which can be run later by executing a single command. The uses of different frameworks are as follows:Selenium: this framework is needed for recording a testcase, exporting it into Java, and executing it on a browserTestng: this framework is used to organize different tests, and to report results.Ant: Provides
"The other tutorials in this series are being translated and clicked on Category: TestNG for viewing." 】
"Translation by mingming like the month QQ 605283073"
Original: http://websystique.com/java/testing/testng-suites-example/
Previous: TestNG Groups example
This article describes the TestNG Suite test, which is rep
Original articles, all rights reserved. Reprint, Attribution: http://blog.csdn.net/wanghantong/article/details/40404939TESTNG provides listeners and intercepts multiple interfaces to develop our own extensions. By implementing these interfaces, we define the behavior we want in the test.Interface list:
Iannotationtransformer (Doc,javadoc)
IAnnotationTransformer2 (Doc,javadoc)
ihookable (Doc,javadoc)
Iinvokedmethodlistener (Doc, Javadoc)
Imethodinterceptor (Doc,javadoc)
When testing with testng, it is common to use a number of parameter configurations, such as database, connection pool, and thread pool.Use TestNG's reference @parameter annotations for self-active readingOriginal article, All rights reserved. Agree to reprint, indicating the source: Http://blog.csdn.net/wanghantongTest code configuration using Multithreading: Configure Data-provider-thread-count= "20" in the ' Java code:/** * * configuration file:
1. What is Ant?is a tool that links software compilation, testing, deployment, and other steps together to automate2. Download and installHttp://www.cnblogs.com/yuzhongwusan/archive/2013/03/26/2982411.html3, the use in the ECLIPCEPreparatory work:Project Right-click--new--folder--folder name:libPut Testng-6.8.5.jar, Jcommander.jar into LibProject Right--new--file--build.xml (file name cannot be written incorrectly)Put codeXML version= "1.0" encoding=
Getting Started with TestNG
Reprint please retain the author information:
author:88250
blog:http:/blog.csdn.net/dl88250
MSN Gmail qq:dl88250@gmail.comTestNG is a test framework designed to simplify a wide range of test requirements, from unit tests (a class of isolation tests) to integration testing (testing an entire system consisting of multiple packages or even multiple external frameworks, such as using a server), this article presents a simple
5-test methods, test classes and test groups
5.1-test groups
TestNG allows the execution of complex test method groupings. You can not only declare a method to be a group, but you can specify that the grouping contains other groupings.
The testng can then be invoked and is required to include certain groupings and exclude other groupings.
This provides a way to divide the maximum elasticity of the test,
This tutorial is for people with basic Java language skills to learn1, preparation tools: JDK, Eclipse (specific installation please Baidu)2. In eclipse, create the project as follows 3, set the project code UTF-8Project name right-click--properties--resource--other:utf-84, then create a class:httprequest, put in the code(The interface can be called without scrutiny implementation)Package Com.lx;import jav
Spring integrates Junit testNGSpring provides a set of test integration interface classes specifically for Junit testNG-AbstractSpringContextTests class. For testNG, it is its subclass: AbstractTestNGSpringContextTests. After the integration of Spring and testNG, spring injection can be easily used as long as the test class inherits this class during unit testing
Originating From: http://magustest.com/blog/automationtesting/webdriver-testng/Selenium 2 has been released for one months, the official version has reached Selenium 2.3, and 2.4 downloads can be found in Google code. Selenium 2 The biggest update is the integration of the webdriver. What is the relationship between the two? If you search for Webdriver, the first result is selenium. In fact Webdriver and selenium can be said to be in the implementatio
Group testing in TestNG is a new innovative feature that does not exist in the JUnit framework, it allows scheduling to appropriate partial methods and preform complex test method groupings. Not only can you declare those methods that belong to a group, but you can also specify a group that contains other groups. TestNG can then call and ask to include a specific set of groups (or regular expressions) and e
We have already achieved the perfect combination of Jenkins and testng, but some drawbacks have been found during use, mainly because the correlation between test code and test cases is not strong, and the test code execution status cannot be directly associated with the test case execution status! To solve this problem, you must use a test management tool to manage the code, use cases, and execution status in a unified manner. In order to quickly sol
HttpClient Tutorial: https://www.yeetrack.com/?p=779One, the required environment:1,testng, httpclient, and related dependency packagesSecond, using the httpclient login Csdn interface, using testng as the Unit Test framework:1 Importorg.apache.http.HttpEntity;2 ImportOrg.apache.http.HttpResponse;3 ImportOrg.apache.http.NameValuePair;4 Importorg.apache.http.client.HttpClient;5 Importorg.apache.http.client.e
TestNG the official document of the Chinese translation of the second chapter, see the original http://testng.org/doc/documentation-main.html
2-annotation
Here is a quick preview of the annotation used in testng, as well as their properties.
@BeforeSuite: The annotated method will run before all tests run
@AfterSuite: The annotated method will run after all tests run
@BeforeTest: The annotated method w
TestNG is part of some of the predefined listener libraries. By default, these listeners join any test execution and produce different HTML and XML reports for any test execution. The report produces a folder named Testoutput by default and can be changed to any other folder by configuration. These reports contain some specific reports of HTML and XML testng.Create a test case classCreate a Java class named Sampletest.java in C + + > Testng_workspaceI
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.