Blog Archives

Integration Testing with DB Unit

First checkout DB Unit:  http://dbunit.sourceforge.net/ DbUnit is a JUnit extension targeted at database-driven projects that, among other things, puts your database into a known state between test runs. … DbUnit has the ability to export and import your database data

Tagged with: , , ,
Posted in Database, JUnit, Testing

Testing with SpringJUnit4ClassRunner

Testing with SpringJUnit4ClassRunner is breeze. First add annotations: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { “/appContext.xml” }) public class SimpleDaoTest{ … } Place resources on classpath: src/main/test/resources Add dependencies: <dependency>     <groupId>org.springframework</groupId>     <artifactId>spring-test</artifactId>     <version>${springframework.version}</version>     <scope>test</scope> </dependency> Annotate test class: @Autowired

Tagged with: , ,
Posted in JUnit, Spring, Testing

VisualVM with firewall

Helpfull article which explains how to get JVisualVM running on a Linux system with a firewall: http://blog.markshead.com/1129/connecting-visual-vm-to-tomcat-7/ The trick was to setup a Listener in Tomcat’s server.xml : <!– JMX  –>   <Listener className=”org.apache.catalina.mbeans.JmxRemoteLifecycleListener”     rmiRegistryPortPlatform=”8000″ rmiServerPortPlatform=”8001″ /> The rmiRegistryPortPlatform

Posted in Java, Performance, Testing

Load testing with Jmeter

Found these 2 useful articles that explain how to Load test a Spring WebFlow application with Jmeter: Article #1: http://spring.io/blog/2007/06/22/putting-spring-web-flow-to-a-load-test/ – June 2007, still useful but unfortunately the images are no longer hosted 😦 Article #2: http://theworkaholic.blogspot.com/2010/08/jmeter-with-spring-webflow.html – 2010 Note:

Tagged with:
Posted in Performance, Spring, Spring WebFlow, Testing

Selenium

1) Head over to http://www.seleniumhq.org/ 2) Install Selenium IDE (Firefox) 3) Download the Selenium Server & IE Driver Server 4) Download the Web Driver bindings for Java  <dependency>     <groupId>org.seleniumhq.selenium</groupId>     <artifactId>selenium-parent</artifactId>     <version>2.36.0</version> </dependency> References http://blog.reallysimplethoughts.com/2013/02/18/webdriver-playback-in-selenium-ide-is-here/

Posted in Selenium, Testing

Unit Testing

Mockito is a mocking Framework <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-all</artifactId> <version>${mockito.version}</version> <scope>test</scope> </dependency> It allows us to easily mock objects: mock(MyService.class) //using mock static method or @Mock +  MockitoAnnotations.initMocks(this); We can specify the desired behavior of the mocks using Mockito’s fluent APIs:

Tagged with: , ,
Posted in JUnit, Mockito, Testing