JUnit testing and Spring How to benefit from Spring support for jUnit during development.

Slides:



Advertisements
Similar presentations
Unit Testing Australian Development Centre Brisbane, Australia.
Advertisements

WaveMaker Visual AJAX Studio 4.0 Training
J-Unit Framework.
Visual Designer for JasperReports
T ESTING WITH J UNIT IN E CLIPSE Farzana Rahman. I NTRODUCTION The class that you will want to test is created first so that Eclipse will be able to find.
Unit and Functional Testing with JUnit and Related Tools Greg Barnes University of Washington
Next Generation Node (NGN) Technical Overview April 2007.
Introduction to Eclipse, Unit Testing and JUnit David Rabinowitz.
JUnit. What is unit testing? A unit is the smallest testable part of an application. A unit test automatically verifies the correctness of the unit. There.
Session-01. Hibernate Framework ? Why we use Hibernate ?
Fresher Technology Specific - JAVA Stream Hibernate Framework
UPortal Developers MIT August 2004 Persistence Strategy for uPortal 3 Mike DeSimone the r-smart group
MAVEN-BLUEMARTINI Yannick Robin. What is maven-bluemartini?  maven-bluemartini is Maven archetypes for Blue Martini projects  Open source project on.
Build Robust Web Apps in the Real WakeUpAndCode.com.
JDBC and Hibernate Joshua Scotton. Connecting to Relational DBs.
Entity Beans BMP Celsina Bignoli
Testing in Extreme Programming
EXtreme Programming: Test-First Copyright Rick Mugridge Test-First Programming Rick Mugridge Department of Computer Science University of Auckland.
TDDD05 EJB Lab (Part of slides reused from Mikhail’s) Lu Li
Copyright  Oracle Corporation, All rights reserved. 4 CMIS Powell Oracle Designer: Creating the Database Design CMIS Powell.
Eurotrace Hands-On The Eurotrace File System. 2 The Eurotrace file system Under MS ACCESS EUROTRACE generates several different files when you create.
Seminar on. Overview Hibernate. What is it? Hibernate. How does it work? Hibernate Tools.
1 SEG4912 University of Ottawa by Jason Kealey Software Engineering Capstone Project Tools and Technologies.
Running Kuali: A Technical Perspective Ailish Byrne - Indiana University Jay Sissom - Indiana University Foundation.
RMS Importer Status MACS Week March 2011 PP b-ABR_RMSImporterStatus Angela Brett RMS Importer Status 1.
Deploy With Confidence Minimize risks Improve business output Optimize resources.
Spring Database Access Ojitha Kumanayaka Copyright © Virtusa, 2007.
First BlueJ Day Houston, 2006 Unit Testing with BlueJ Bruce Quig Deakin University.
Automated Deployment Framework Using TFS and Custom PowerShell cmdlets to create an automated deployment framework.
Unit Testing with JUnit and Clover Based on material from: Daniel Amyot JUnit Web site.
Wordpress with Mina Automated Deployment Solution Jonathan Gravato DIG 4104c.
Persistence – Iteration 4 Vancouver Bootcamp Aaron Zeckoski
Fall CIS 764 Database Systems Engineering L18.2 : Object Relational Mapping … ….Object persistence.
Confidential Continuous Integration Framework (CIF) 5/18/2004.
EMBEDDED REAL-TIME, INC. December 8, 2015 Java Unit Mark Mosher Rochester Java Users Group.
Katari Globant 2008 (update to 2010). Katari  Katari is a framework to use as a starting point to develop new web applications.  Incorporates architecture,
Build Robust Web Apps in the Real WakeUpAndCode.com.
1 Unit testing and Java Zeger Hendrikse Cas Stigter.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Testing Spring Applications Unit Testing.
Persistence – Iteration 4 Vancouver Bootcamp Aaron Zeckoski
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Introduction to Data Access with Spring.
(1) Introduction to Continuous Integration Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University of.
(1) Introduction to Continuous Integration Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University of.
Continuous Integration Make your development life simpler.
OpenMRS Create New Module.
Test Driven Development Introduction Issued date: 8/29/2007 Author: Nguyen Phuc Hai.
Programmer Support. Our Primary Goal: Reproduce the Problem.
Unit Testing in Eclipse Presented by David Eisler 08/09/2014.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
Hibernate Online Training. Introduction to Hibernate Hibernate is a high-performance Object-Relational persistence and query service which takes care.
Powerpoint Templates Page 1 Powerpoint Templates Unit Testing Ari Seppi
Software Engineering Lecture 11 Software Testing Presenter: Josef Hallberg 1.
Build Robust Web Apps in the Real WakeUpAndCode.com * aka ASP.NET 5 before RC1.
Introduction to Unit Testing and JUnit David Rabinowitz.
Getting Started with JUnit Getting Started with JUnit The benefits and ease of writing and running JUnit test cases and test suites. The benefits and ease.
當 Java 遇上 DevOps 黃忠成. Java In Azure Storage Table Storage Services NoSQL base storage Fast and Easy to use Blob Storage Services File Storage (photo,
SWE 434 SOFTWARE TESTING AND VALIDATION LAB2 – INTRODUCTION TO JUNIT 1 SWE 434 Lab.
Unit Testing.
A very brief introduction
HAPI on eclipse.
Extreme Programming: Automated Testing and Refactoring
Testing a persistence layer
Your code is not just…your code
CS 240 – Advanced Programming Concepts
The JSF Tools Project – WTP (internal) release review
Developing and testing enterprise Java applications
Data Access Layer (Con’t) (Overview)
Rule Engine Concepts and Drools Expert
Your code is not just…your code
Presentation transcript:

jUnit testing and Spring How to benefit from Spring support for jUnit during development

Basic concepts jUnit framework setUp(), tearDown() testXXX() Spring framework context.xml Inversion of control AbstractDependencyInjectionSpringContextTests onSetUp(), onTearDown()

Faster development Limited need to build or deploy Run jUnit test from Eclipse 10s between High confidence in code Repository of existing tests decreases chance of introducing new bug More satisfaction and peace of mind for developer who checks-in code What we will achieve? Code change Testing it

test-context.xml beans In-memory database Hibernate session <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean" init-method="createDatabaseSchema"> net.sf.hibernate.dialect.HSQLDialect false

Real example Requirement DomainDaoTest.getDomainByNamePattern public Domain getDomainByNamePattern(String namePattern); Development cycle 1. Create new failing test 2. Make it compile 3. Achieve passing test – implement function 4. Commit

1. Create failing test reproducing bug 2. Fix bug (makes test pass) 3. Commit Thanks to existing test it is unlikely that bug will be re-introduced in future. Fixing bug – XP approach

Best practices „Test first“ approach Learn from (or extend) existing tests Import base-test-context.xml Use stubs where appropriate Use UnsupportedOperationException For eclipse generated method body

Existing support in CoreDev BaseTestCase Creates admin user Good for facades testing TestUtils dbUnitSetup populates DB based on dbUnit XML file writeDatabaseDtd generates DTD for dbUnit XML file base-test-context.xml

Common testing issues hibernate.MappingException : Unknown entity class: com.norkom.base.resources.model.Domain Reason: Missing mapping file in classpath Build mapping files Add them to your project sources hibernate.MappingException: duplicate import: Domain Reason: Mapping file twice in classpath Check for linked *.jar in Eclipse, they can contain your *.hbm.xml file, together with one in source folders UncategorizedSQLException: Could not execute JDBC batch update; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; failed batch; Reason: Constraint violated in HSQLDB Swap HSQL to Oracle to see which constraint

Thank you... And enjoy your automated testing