Run one or Exclude one test with Maven

From time to time you only want to run one test, one test method, one class or one package from the command-line.

Or on the contrary: you want to exclude / ignore one specific test or group of tests during the build cycle.

Excluding tests from the build cycle by the command line usually occurs when the following scenarios meet:

  • A test requires significant amount of resources (time, memory, disk space, etc.)
  • The run needs to be independent from the IDE (reenact the Continuous Integration / Continuous Delivery pipeline) as some IDEs load test-dependencies on the compile-time class-path.
  • You have no or limited ability to change the code-base
    Continue reading

Awesome Asciidoctor: Grouping Floating Images

With Asciidoctor markup we can position images in our document. We can even float images, so text can next to an image, inside only below or about the image. We can also define multiple images to float, so the images are displayed on the same line next to each other. Any text that follows these images is also displayed next to the images. If we want only to have floating images, but the text starting under the images we can place the images inside an open block and assign the block the role float-group.

Continue reading

Implementing architectural fitness functions using Gradle, JUnit and code-assert

Architectural fitness functions

Inspired by Neal Ford’s presentation at our Change is the Only constant event I started experimenting with architectural fitness functions. An architectural fitness function provides an objective integrity assessment of some architectural characteristic(s).

If you want to take a deeper dive into evolutionary architectures including fitness functions take look at Neals book: Building Evolutionary Architectures: Support Constant Change.

Neal’s slides contained an example of verifying package dependencies from a Unit Test using JDepend.

 

Verifying code modularity

In this blog post we’ll elaborate on that approach and create a Unit Test that verifies that our code complies to the chosen packaging strategies using an alternative to JDepend named code-assert.

Continue reading

6 Steps to help you debug your application

As a developer sooner or later you will encounter bugs, be it small ones or production breaking bugs.
Now it is your task to find and fix the bug as soon as possible.
In this article I will list the techniques I learned over the course of many years debugging web applications in the hope that it will help you be better and more efficient in bug hunting. Continue reading

JavaOne verslag: De Keynote

Op de eerste volledige conferentie dag van JavaOne stond natuurlijk meteen de keynote gepland. Het eerste gedeelte van de keynote werd verzorgd door de hoofdsponsor Intel en was best vermakelijk al lag de salespitch er wel dik bovenop. Intel lanceerde 2 opensource producten voor de Java community:

Hierna werd er stilgestaan bij de AI library van Intel –> BigDL https://github.com/intel-analytics/BigDL en bij het Vector API developer program van Intel

Als laatste was het woordt aan de architect van Alibaba die vertelde over de enorme schaal van de applicaties die op hun cloud draaien. De architect van Alibaba was zeer goed getraind voor de presentatie want elke vraag werd standaard beantwoord met: ‘Thats a very good question …’

Na de talk van Intel kwamen de Java ‘primeurs’! Een kleine opsomming van de meest belangrijke ontwikkelingen binnen het Java Platform:

  • Alles van het Java EE wordt opensource en gedoneerd aan eclipse en gaat verder onder de naam EE4J Eclipse Enterprise for Java.
  • Oracle Java wordt volledig opensource er is dus geen verschil meer tussen de OpenJDK en de Oracle JDK.
  • Java gaat een kanban stijl hanteren en elke 6 maanden een release uitbrengen met de features die op dat moment gereed zijn. Eerstvolgende release 28 maart 2018!
  • Een interessante quote zie je in de bijgevoegde foto en verwijst naar het feit dat steeds meer bedrijven wanneer de schaal exponentieel toeneemt toch weer teruggrijpen op Java vanwege de schaalbaarheid en stabiliteit.
  • Java en Cloud wordt een intensieve samenwerking tussen Oracle en Kubernetes!
  • Java 9 is eindelijk uit!
    • Quotes van Oracle
      • Jigsaw doesn’t break everything. It breaks some things
        • If your code only uses java se 8 APIs then it will most likely work on JDK 9
        • If your code depends upon JDK internals then it may require change
        • If your code uses JDK internal APIs then it will not compile on JDK 9
        • openjdk.java.net/projects/jigsaw
    • Javadoc van Java 9 laat overzichtelijk de module afhankelijkheden zien en er kan gezocht worden OMG!!
    • IntelliJ en Eclipse ondersteunen Java 9 al
    • Voor de komende release staan de volgende features gepland en wat af is wordt op 28 maart gereleased:

One more thing, tijdens de keynote werd het fn Project open source gemaakt! Het fn Project is een container native Serverless platform.

De keynote terugkijken, dat kan hier: https://twitter.com/javaoneconf/status/915075482512613376

Dat was de keynote op naar mijn eigen sessie!!

Awesome Asciidoctor: Using Paragraphs in Lists With List Item Continuation

When we write a list in Asciidoctor we can simply create a list item by starting the line with a dot (.). To create a another list item we simply start a new line with a dot (.). But what if we want to add a list item with multiple paragraphs, or text and a source code block element. We can use the list item continuation (+) to indicate to Asciidoctor we want to keep these together for a single list item.

Continue reading

Spocklight: Reuse Variables In Data Providers

Writing a parameterized specification in Spock is easy. We need to add the where: block and use data providers to specify different values. For each set of values from the data providers our specifications is run, so we can test for example very effectively multiple input arguments for a method and the expected outcome. A data provider can be anything that implements the Iterable interface. Spock also adds support for a data table. In the data table we define columns for each variable and in the rows values for each variable. Since Spock 1.1 we can reuse the value of the variables inside the data provider or data table. The value of the variable can only be reused in variables that are defined after the variable we want to reuse is defined.

Continue reading

Spocklight: Group Assertions With verifyAll

We all know writing tests or specifications with Spock is fun. We can run our specifications and when one of our assertions in a feature method invalid, the feature method is marked as failed. If we have more than one assertion in our feature method, only the first assertion that fails is returned as an error. Any other assertion after a failing assertion are not checked. To let Spock execute all assertions and return all failing assertions at once we must use the verifyAll method. We pass a closure with all our assertions to the method. All assertions will be checked when use the verifyAll and if one or more of the assertions is invalid the feature method will fail.

Continue reading

Extending Selenium with page objects

As all who have used it know Selenium is a powerful tool when testing front-end applications. I personally use it in combination with protractor. This is because most of the work I do is with Angular and AngularJS applications.

When you are using Typescript extending classes is an easy thing. In light of this I’ve been experimenting with new approaches to creating page objects. Continue reading