2012年4月28日星期六

Dre Beats Cheap

Concept:JUnit is a regression testing framework .The JUnit test is programmer tests ( for unit testing ) ,the so-called white box testing .Features: 1 used for testingresult expected assertion ( Assertion ) can be tested before setting a desired results & # 20540;,and then use assertions to determine expectations & # 20540;and the actual & # 20540;whether the same .
2 for the sharing of common test data test tools by using the JUnit test data will be saved to the database ,so other people can directly use .3 to facilitate theorganization and running of the test suite using JUnit test is very simple, as long as the heir to the TestCase can be, and you can use the JUnit Test directly run the test method .
4 graphics and texttest running device in addition to directly run the test method [url=http://www.beatsbydreaudio.co.uk]Dre Beats Cheap[/url]

http://www.beatsbydreaudio.co.uk

,also can create a main method ,setting operation mode for graphics or text ,in Java Application operation .
Example :in the first project to introduce the JUnit jar package ( in Hibernate_Home / lib / directory) ,and then write the test class :package com.dan.hibernate ;import junit.framework.TestCase ;import org.
hibernate.Session ;import org.hibernate.SessionFactory ;import org.hibernate.cfg.Configuration ;public class SessionTest extends TestCase {public static void main ( String args ) { / / Text Test running device / / junit.
textui.TestRunner.run ( SessionTest.class ) ;/ / graphics test run of junit.swingui.TestRunner.run ( SessionTest.class ) ;} public void testGet ( ) {Session session = null ;try { / / read the hibernate.
cfg.xml file Configuration CFG = new Configuration ( ) . Configure ( ) ;/ / SessionFactorySessionFactory factory = cfg.buildSessionFactory ( ) ;session = factory.openSession ( ) ;session.
beginTransaction ( ) ;User user = ( User ) session.get ( User.class ," ;4028983c35b79b760135b79b77aa0001") ;/ / actual values String username = user.getName ( ) ;/ / set the expected value String expected = " ;Zhao Dandan " ;;/ / use assertions to view the expected value and the actual value is the same this.
assertEquals ( Expected ,username ) ;System.out.println ( " ;testGet: " ;username ;session.getTransaction ( + ) ) . Commit ( ) ;} catch ( Exception E ) {e.printStackTrace ( ) ;session.
getTransaction ( ) . Rollback ( ) ;} finally {if ( session != null ) {if ( session.isOpen ( ) {session.close ( ) ) ;} } } } } using a JUnit running testGet ( ) results :the
success of console output :testGet: Zhao Dandan fails then the console output ,while JUnit will prompt the failure :the use of text test runner ( using the Java Application running main
Source by the beats by dre relate article:

没有评论:

发表评论