http://fuxueliang.com/java/2013/06/26/junit-4-vs-testng--comparison/
These two days are reading a book, Java test new technology TestNG and advanced concepts, the author is the founder of TestNG, learned a lot about the knowledge of TestNG, read an article basically put thi
Source: Cong Collan's BlogOriginal source 2:http://www.importnew.com/16270.html————————————————————————————————————————————Junit 4 and TestNG are very popular unit test frameworks in Java. The two frames are very similar in function. Which is better? Which framework should we choose in the Java project?A comparison of the functional characteristics of JUnit 4 and
Now that you've learned about testng and its various tests, if you're worried about refactoring existing JUnit code, it's not necessary to use testng to provide a way to follow your own rhythm from JUnit and testng. You can also use Test
5.10-rerunning failed Tests
When a test in a suite fails, each testng creates a file named Testng-failed.xml in the output directory. This XML file contains the necessary information to rerun only these failed test methods, allowing only those failed tests to run without having to run all the tests. Thus, a typical scenario would be this:
java -classpath testng.jar;%CLASSPATH% org.testng.TestNG -d test-o
Development process, often use Java testing, front-end Javas cript debugging relatively easy, firebug,console.log (), but Java is more tangled point, each change to compile and run, the process is relatively slow, plus if the project is relatively large, Very DT, have to listen to friends say their company's project is EJB, development time every time to make a small change will take a few minutes to redeploy on the server. In order to reduce the debugging process, improve the development effici
:" + driver.gettitle ());Driver.quit ();}@Testpublic void Test_case3 () {Driver = new Firefoxdriver ();Driver.get ("http://www.google.com.hk");webelement element = Driver.findelement (By.name ("Q"));Element.sendkeys ("Hello selenium!");Element.submit ();}}-----9.3Run run_selenium.batand start the selenium RC server. Right-click Case3.java,run as->testng Testto perform the following successful results:when you finish executing, you will generate a Test
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 inje
Consolidate JUnit for testing:
JUnit has natural support for spring, and just add two annotation to start the spring context, the sample code is as follows:
@ContextConfiguration ("/meta-inf/spring/integration/inbound-gateway-config.xml")
@RunWith ( Springjunit4classrunner.class) Public
class Inboundgatewaytests {
@Autowired
private Simplewebserviceinboundgateway Gateway;
}
Integrate
Selenium+eclipse+junit+testng+python Step three download Selenium IDE,seleniumrc,iedriverserver, seleniumclient Drivers Selenium official website :http://www.seleniumhq.org/download/1 . Selenium IDE:selenium-ide-2.2.0.xpi is used to record scripts on Firefox. 2, Selenium RC:selenium-server-standalone-2.33.0.jar analog server side, not less. 3, iedriverserver:driverserver_win32_2.33.0.zip IE driver,Firfox
way priority to execute3, how to deal with the dependency problem of the method4, if you need one or more variables (such as cookies), how to transfer in the code, so that today and tomorrow make all the different parameters can be usedThe above issues can also be resolved in JUnit, the solution in testng more elegant and elegant a bit ~, the following two files are prepared or the original project, one is
Introduction to the Junit test frameworkThe test framework is the most popular Java unit testing framework. JUnit is used to develop unit tests on Java classes. It is a class package that provides a variety of ways to test methods in a Java class. Junit 4 Features
Simple annotations that provide the basic features of writing
4-run
Testng can be called in multiple ways:
Command Line
Ant
Eclipse
Intellij's idea
This section only describes how to run testng from the command line. If you are interested in other methods, click the above link to view more information.
Assume that testng is already in your class path. The simplest call method is as follows:
java org.testng.TestNG test
-DgroupId=org.martingilday -DartifactId=test1 -DarchetypeGroupId=org.martingilday -DarchetypeArtifactId=testng-archetype -DarchetypeVersion=1.0-SNAPSHOT -DremoteRepositories=http://www.martingilday.org/repository/
Of course, you can replace it with your own groudid and artifactid.
Don't forget to come to Martin's blog frequently to see if there are more updates.
Maven 1 (by Andrew Glover)
The testng Maven
3-testng. xml
There are multiple methods to call testng:
UseTestng. xmlFile
Use ant
Use command line
This section describesTestng. xml(You will find relevant documents about Ant and command line below ).
CurrentlyTestng. xmlThe DTD you use can be found on the home page: http://testng.org/testng-1.0.dtd (for more convenience, you can browse the HTML Version )
This paper mainly describes the basic theoretical knowledge of TestNG, TestNG the specific, writing the test process three steps, and junit4+ differences, so that the pro-TestNG test framework can have a simple cognition.Hope to be able to beginners TestNG test framework of the pro-helpful. If there is any deficiency,
automated testing based on SELENIUM2 and testng 0 Reviews2013-09-06 11:10 it168 website Original author: Huang Fu Peng Chenyu editor: Shen AnThe "IT168 technology" selenium is a popular web-oriented automated testing tool, which has many people's pro-gaze for its high efficiency and wide coverage of browsers. TESTNG is a test framework derived from JUnit and nun
: Allows multiple test tasks to be run concurrently and in different environments, dramatically speeding up the functional testing of Web applications.
The idealized use of selenium to write test case is to perfect the test script by selenium the IDE record script, through Firebug to help locate the page element, and then through the selenium RC. The Selenium IDE is a Firefox plug-in that can be scripted and case converted, so Selenium Ide+firebug will be the two biggest helpers for your future
Eclipse Version: LunaOnline installation of testng version 6.9This issue occurs because the TestNG version issue or the features plugin is not installed on the online installationThe following are the solutions:Found a lot of classmates and I just as unable to install testng online, now share an offline installation method, and installation files, hoping to help
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.