Upcoming SlideShare
Loading in...5




Unitils Testing FrameWork presentation

Unitils Testing FrameWork presentation



Total Views
Views on SlideShare
Embed Views



2 Embeds 9

http://www.slideshare.net 6
https://duckduckgo.com 3



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    Unitils Unitils Presentation Transcript

    • [email_address]
    • Agenda
      • Api Description
      • Features
      • Unitils Design
      • Supported Module System
      • Unitils by Example
    • Unitils test Tool
      • Unitils is an open source library aimed at making unit testing easy and maintainable. Unitils builds further on existing libraries like DBUnit and EasyMock and integrates with JUnit and TestNG .
      • Unitils provides general asserion utilities, support for database testing, support for testing with mock objects and offers integration with Spring and Hibernate . It has been designed to offer these services to unit tests in a very configurable and loosely coupled way. As a result, services can be added and extended very easily.
    • Currently Unitils offers following features
      • Assertion utils
        • Equality assertion through reflection, with different options like ignoring Java default/null values and ignoring order of collections
      • Database testing utilities :
        • Test data management
        • DBUnit
        • Test database maintenance
        • Testing with Hibernate
    • Currently Unitils offers following features
      • Mock object utilities
        • Simplify EasyMock mock object creation
        • Simplify mock object injection
        • EasyMock argument matching using reflection equality
      • Spring integration
        • ApplicationContext configuration and easy injection of spring managed beans into a unit test
        • Support for using a Spring-configured Hibernate SessionFactory in unit tests.
      • The project started begin 2006 from an Ordina J-Technologies discussion group on unit testing. The result was a list of guidelines and Unitils emerged in an attempt to write code to support these guidelines.
    • Open & extensible architecture
      • Module system
        • Listener hooks up modules into tests
        • Support for JUnit 3 / 4 + TestNG
    • Module Systems
      • Database Module
      • DBUnit module
        • Test data management
      • HibernateModule
      • Hibernate Configuration,Verify database mapping
      • SpringModule
        • Load application Context, retrieve spring beans
      • EasyMock Module:create mocks,lenient reflections arguments matching.
    • Database testing
      • Control over test data
        • Unit test database without data
        • Small test data sets
      • Limited sharing of data sets
        • Test class or method level
    • Class-level data file
    • Method-level data file
    • Specify file name explicitly
    • Result data file
    • Hibernate support
      • Simplify configuration
      • Automatically check consistency of
        • mapped classes with database
    • Assertion utils
    • Maintainability
      • Only check what’s essential
        • Ignore type of numbers
        • Ignore certain properties
        • Ignore order and type of collections
    • Ignore order and type of Collections
      • Leniency option: collections
    • Unitils Configuration
      • As with many projects, Unitils needs some configuration of its services. By default, there are 3 levels of configuration, each level overriding the settings of the previous one
        • unitils-defaults.properties : default configuration that is shipped with the distribution of Unitils
        • unitils.properties : can contain project-wide configuration
        • unitils-local.properties : can contain user-specific configuration
    • Programme a tester
      • Employees : DTO Object
      • IEmployeeDao : interface that declare CRUD opperations
      • EmployeeDaoImpl :a spring hibernate implementation
      • DataSource.xml :Spring Config DataSource
      • HibernateSessionFactory.xml: Spring Config of the hibernate SessionFactory
      • Dao.xml : DAO Beans
    • Programme de test
      • HibernateMappingTest
      • EmployeeDaoTest :
      • EmployeeDao Testing Class
      • Unitils.properties : unitils config file
    • Configuration Unitils « unitils.properties »
    • HibernateMappingTest
      • @SpringApplicationContext annotation instructs Unitils to create a Spring ApplicationContext, in which the DataSource.xml and HibernateSessionFactory.xml files are loaded
      • HibernateUnitils Unitils contains a very simple but powerful mapping test. This test checks whether the mapping of all Hibernate mapped objects is consistent with the database
    • HibernateMappingTest «   propety title of class Employees result goes titleD »
      • junit.framework.AssertionFailedError: Found mismatches between Java objects and database tables. Applying following DDL statements to the database should resolve the problem:
      • alter table public.employees add column titleD varchar(0);
    • EmployeeDaoTest
      • Creating an application context and retrieving a Spring bean
      • we tell the system to find a bean of type employeeDao in the application context
      • Loading a test data set
      • Checking the result
    • Links
      • Unitils website:
      • http://unitils.sourceforge.net
      • Unit testing guidelines:
      • http://unitils.sourceforge.net/guidelines