How to setup MySQL on local PC

In this post, we will learn how to setup MySQL on our local machines/system. This is one of the possible way to install, although you may prefer another approaches. We will be installing both workbench and MySQL Server together using MySQL Community Server Let’s begin. Step 1: Download Community Server from here. Current version is…

Continue reading

Spring 4 MVC+Hibernate 4+MySQL+Maven integration + Testing example using annotations

This post shows you how to Unit and integration test your Data layer, service layer and view layer in a Spring 4 MVC + Hibernate 4 + MySQL + Maven integration application. This post is continuation of Previous post. In this post we will learn how to add unit and integration test in SpringMVC and…

Continue reading

TestNG Mockito Example Stubbing Void Methods

In this post we will learn about using TestNG and Mockito together. We will also learn about stubbing void methods with Mockito. Mockito library enables mocks creation, verification and stubbing. In simple terms, mock objects comes handy in situations like when you are testing a class [A] which depends on another class [B]. To test…

Continue reading

TestNG @DataProvider Example

In this post we will learn about TestNG @DataProvider annotation to parameterize your tests in order to write data-driven tests. In data-driven testing, we run the same tests multiple times but with different sets of data which we pass into test methods using parameters.Let’s get going. Let’s take a simple Calculator example: Above class have…

Continue reading

TestNG @Parameters Example

In this post we will learn about how to parameterize your TestNG tests using TestNG @Parameters annotation which is used to pass simple primitive parameters from configuration file to test methods. These parameters are defined in suite [testng.xml] file. Let’s get going. In TestNG, there are primarily two popular ways to pass parameters to your…

Continue reading

TestNG dependsOnGroups Example

In this post we will see TestNG groups dependency example showing a test depending on groups of tests methods using @Test annotation’s dependsOnGroups and alwaysRun attributes. Let’s get going. dependsOnGroups : dependsOnGroups attribute on a test method [test1 e.g.] specifies all the groups [group1, group2,..] this test method depends on. It means test1 will start…

Continue reading

TestNG dependsOnMethods Example

In this post we will see TestNG dependency example between different test methods using @Test annotation’s dependsOnMethods and alwaysRun attributes. A very simple and real life use case [where these attributes can be handy] is user update operations e.g. In order to update a user, it must be created at first place. So while writing…

Continue reading

TesNG expectedExceptions example

In this post we will learn how to use TestNG expectedExceptions feature to test the expected exception your code might throw in certain situations. We can annotate a test method with particular exception information using @Test(expectedExceptions = Exception.class) if we know that the method will throw this kind of exception during execution. Let’s get going….

Continue reading

TestNG timeOut example

In this post we will learn how to configure TestNG Tests to timeout after certain time, using TestNG timeout feature with help of @Test(timeOut = 1000). A @Test is supposed to complete its execution within very short time. In case a @Test is taking unreasonably long-time than expected, it’s something to investigate. In those situations,…

Continue reading