Home » Tag Archives: Testing (page 2)

Tag Archives: Testing

Writing Clean Tests – Trouble in Paradise

mockito-logo

If our code has obvious faults, we are very motivated to improve it. However, at some point we decide that our code is “good enough” and move on. Typically this happens when we think that the benefits of improving our existing code are smaller than the required work. Of course, if we underestimate our return of investment, we can make ...

Read More »

Testing Interface Invariants

software-development-2-logo

Today’s article is something a little special. It’s the first article where I use code from my current personal project for examples. You will be getting “real world” examples and not silly, made-up examples like my Scientist and Pen example in my factories article. My Project Because of this, I’m going to make a quick introduction to what the project ...

Read More »

Nifty JUnit : Using Rule on Method and Class level

junit-logo

As shown in a the post Nifty JUnit : Working with temporary files, it is possible to use @Rule in a JUnit test, which is a Method level Rule. In this example I would like to show the variation of the @ClassRule for a Class level Rule. Method Rule The @Rule is fired before each test method (just like @Before) ...

Read More »

Using junit for something else

junit-logo

junit != unit test Junit is the Java unit testing framework. We use it for unit testing usually, but many times we use it to execute integration tests as well. The major difference is that unit tests test individual units, while integration tests test how the different classes work together. This way integration tests cover longer execution chain. This means ...

Read More »

Refactoring to Allow Test Doubles

software-development-2-logo

Sometimes, when you make a class, it directly instantiates an object to use in its methods. For example:                   public void myFunc() { MyType object = new MyType(); object.doSomething(); this.thingy = object.getSomething(); } This is generally viewed as bad, since you’re tightly coupling your class to the instantiated one. “But,” you say, ...

Read More »

Unit Test, System Test, Red Test, Green Test

software-development-2-logo

We tend to categorize different types of tests according to what they cover. Unit tests cover small portions of code, usually a method or a class, while we mock the rest of their interaction. Integration tests cover several components in concert, and then mock the other boundaries. System tests and their bigger brothers, End-to-End tests cover more and more. Those ...

Read More »

Stress testing the OIM web (UI) layer

java-interview-questions-answers

The default configuration in Oracle IDM reserves 20 threads dedicated for serving front end (UI) requests. This basically means that the application server has a pool of 20 threads which it can utilize to serve users who are accessing OIM via the web console (/identity or /sysadmin). In case of Weblogic, this is how it is configured:       ...

Read More »

Do not unit test bugs

java-logo

Before getting to the topic of the title let’s have a simple programming sample. On the programming task I will demonstrate some bad coding style and based on that it will be easier for me to explain why the same style is bad in unit tests. Well, now that I wrote this sentence this seems to be a obvious statement. ...

Read More »

Challenging Myself With Coplien’s Why Most Unit Testing is Waste

software-development-2-logo

James O. Coplien has written in 2014 the thought-provoking essay Why Most Unit Testing is Waste and further elaborates the topic in his Segue. I love testing but I also value challenging my views to expand my understanding so it was a valuable read. When encountering something so controversial, it’s crucial to set aside one’s emotions and opinions and ask: “Provided ...

Read More »

Testing System.in and System.out with system-rules

java-logo

Writing unit tests is an integral part of software development. One problem you have to solve when your class under test interacts with the operating system, is to simulate its behaviours. This can be done by using mocks instead of the real objects provided by the Java Runtime Environment (JRE). Libraries that support mocking for Java are for example mockito ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.