Unitils
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Unitils

  • 2,844 views
Uploaded on

Unitils Testing FrameWork presentation

Unitils Testing FrameWork presentation

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
2,844
On Slideshare
2,835
From Embeds
9
Number of Embeds
2

Actions

Shares
Downloads
38
Comments
0
Likes
0

Embeds 9

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

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. [email_address]
  • 2. Agenda
    • Api Description
    • Features
    • Unitils Design
    • Supported Module System
    • Unitils by Example
  • 3.  
  • 4. 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.
  • 5. 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
  • 6. 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.
  • 7.  
  • 8. Open & extensible architecture
    • Module system
      • Listener hooks up modules into tests
      • Support for JUnit 3 / 4 + TestNG
  • 9. 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.
  • 10. 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
  • 11. Class-level data file
  • 12. Method-level data file
  • 13. Specify file name explicitly
  • 14. Result data file
  • 15. Hibernate support
    • Simplify configuration
    • Automatically check consistency of
      • mapped classes with database
  • 16. Assertion utils
  • 17. Maintainability
    • Only check what’s essential
      • Ignore type of numbers
      • Ignore certain properties
      • Ignore order and type of collections
  • 18. Ignore order and type of Collections
    • Leniency option: collections
  • 19. 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
  • 20.  
  • 21. 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
  • 22. Programme de test
    • HibernateMappingTest
    • EmployeeDaoTest :
    • EmployeeDao Testing Class
    • Unitils.properties : unitils config file
  • 23. Configuration Unitils « unitils.properties »
  • 24. 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
  • 25. 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);
  • 26. 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
  • 27. Links
    • Unitils website:
    • http://unitils.sourceforge.net
    • Unit testing guidelines:
    • http://unitils.sourceforge.net/guidelines