I released five new sample lessons from my Test With Spring course: Introduction to Spock Framework

What Kind of a Spring Testing Book Would You Love to Read?

As some of you know, I wrote a book about Spring Data which was published in November 2012. When that book was done, I swore that I would not write another book in the near future. However, when time passed by I started to think that I would like to write a book about my true passion.

It is not a secret that I am a bit of a testing fanatic. I am also aware that there are some great testing books out there. The problem is that none of those books concentrates on testing applications which use Spring Framework.

I would like to fill that void. When I wrote my first book, I decided what I want to put in it. Although it did work out pretty well, this time I would like do things a bit differently. That is why I am asking your opinion about the style and the content of the book.

To be more specific, I would like to have answers to these questions:

  • What kind of a style the book should have? Should it be a tutorial style book or more like a reference manual?
  • What kind things should be covered in the book?
  • Do you think that there is a market for a book which talks about the testing of Spring applications?

You can answer these questions by adding a comment to this blog post. Thank you in advance!

About the Author

Petri Kainulainen is passionate about software development and continuous improvement. He is specialized in software development with the Spring Framework and is the author of Spring Data book.

About Petri Kainulainen →

24 comments… add one
  • First of all i’m kinda happy to know that you have an intention to write a book about software testing especially in the Spring framework world :D.

    Personally i prefer tutorial style approach to reference manual.

    Since the limitation of testing is in Spring framework then it will be good to cover unit and integration testing from controller, service
    and to repository and don’t forget to cover security and Rest testing.

    Yes of course there is a market for a book which talks about the testing of Spring application, Spring itself is world wide used

    Reply
    • Thank your for your comment! I really appreciate that you took the time to help me out.

      Reply
  • Hi Petri
    Having some random thoughts about this. Out of these, you might already have planned to cover, but still wanted to state –

    1) Please do take examples using some open source mocking framework.

    2) Please throw some light on how Spring and OSGi (Modular Java) based applications can work in Continuous integration environment.

    3) As you know, ppl are more interested to read ebooks these days so it would be great if you could have this book available on safari online, Flipkart ebooks (Android app) etc.

    4) Depicting and co-relating with design patterns in a testing book always bring reader’s more interest

    5) Please write a topic on building an “Automation framework” using Selenium etc.

    6) How to write concurrent/parallel tests would empower reader

    7) Best approaches designing applications so that the testing can easily be performed

    Thanks!

    Reply
    • Thank you for your comment. You definitely gave me something to think about. Thanks again!

      Reply
    • +1

      Reply
  • To answer your questions…

    1) The style I like the most is that which shows a table of contents that looks like a reference book but the actual content is developed in tutorial form; this makes it easy to use the book as a reference but, at the same time, the content is actually readable and easily understood with well written, actually tested, examples

    2) it may seem obvious but most newbies do not understand the difference between unit and integration testing for instance; also, as already suggested, mocking with oss such as mockito and easymock should be extensively treated

    3) I would definitely buy a copy myself and I know colleagues who would do the same as soon as it gets published

    As an avid buyer of tech related ebooks I would like to suggest to carefully choose an editor that makes your books available without DRM… watermarking my full name and email address in the book is okay but, please, avoid DRM at all costs as it is an unnecessary draconian burden placed on us people who actually buy ebooks. Good luck with the book.

    Reply
    • Thank you for your comment.

      I especially liked your suggestion to structure the table of contents like a reference manual but write the actual book by using tutorial style. This reminds me of the style which used in the books published under the “In Action” brand. I think that I will start studying the structure used in these books. Again, thanks for the valuable idea!

      By the way, I agree that DRM hurts people who actually buy books, games, movies or music. This sucks because it doesn’t make any sense the piss off the people who actually buy your products.

      Reply
  • First of all I agree with the previous comments, there have been very good points.

    I’d like to add that if you’re writing a book about spring testing, you should be very light on the general spring part because someone wanting to learn about spring basics probably wouldn’t pick the book. The book should instead go deep on it’s scoped subject.

    Also what I would like to read is some well thought tdd design philosophies related to spring and some really challenging scenarios among the usual.

    I prefer the tutorial style of writing and style where when I’m reading I feel like someone is explaining this to me and not just listing facts.

    Reply
    • Thank you for your comment!

      I agree that limiting the scope of the book is very important. If you have read my tutorials, you have probably noticed that limiting the scope of the tutorial is quite hard to me. I have to pay more attention to this if I end up writing this book.

      Reply
  • Personally I would prefer “recipes” style, with little bit of background in first chapter and then all topic-wise grouping of recipes.

    Its just apt for the problem you are investigating and trying to fix.

    and please keep it accessible thru safarionline.

    All the best,

    Reply
    • Thank you for your comment. It gave me something to think about (style and distribution).

      Reply
  • Petri,
    I went through your tutorial “Test Spring MVC”. Excellent write up. The tasks of each post are very clear and I am looking forward to buy your WIP Spring Test Book. I was able to get complete information on testing the controllers. I hope you will explain more about testing (and mocking) services, DAO’s for Spring MVC application. I really appreciate your work. Thank You.

    Reply
  • Petri,

    How’s your book going? I for one will be buying it as soon as it comes out.
    As for recommendations (if it’s not too late) here are mine:

    1. Please make sure to ensure best approaches for designing applications are included so testing can be added without too much hassle. One particular scenario: Shared context in multiple web apps under a single application.
    2. Other approaches for suitable environments are really welcome, advantages of practices such as continuous integration, unit and integration tests, open source mocking solutions (Mockito) and how to choose the right test coverage, for example.
    3. Testing Spring Security, Rest and XML services and standard Web scenarios. Open source view technologies such as Jsp and Thymeleaf.
    4. Cover the whole vertical app slice: Testing Repository, Services and Controllers.
    5. Database fixtures! how do you test your CRUD methods, with Oracle, SQL Server or MySQL? how do you make sure the DB has a consistent state before testing?
    6. Probably a heads up on reporting test results will be nice.

    Having said this, thank you a lot for your tutorials Petri. I like your style of writing and they been really helpful. Keep up the hard work.

    Reply
    • Hi Reynaldo,

      I have to confess that I haven’t done ANYTHING to this book. Your feedback made me realize that I should do something about this (after all, I now know that least one person will buy it!).

      I just created a new board to Trello and added the first task (create TOC) to it. The deadline of this task is 26th of January. I will write more about this project after I have finished that task.

      Reply
  • Hi Petri,

    I admit I’m finding MockMVC quite problematic, so you may get into that, and by problematic I mean

    1. no support for JSP views (other than verifying that you’ve reached the one you expected, which only tests that Spring is working, and tells you nothing about your app
    2. no direct support for Spring Security (though StackOverflow has many workarounds published).

    So it seems to me if you have to swap out to Velocity or Freemarker to also be able to test your generated content, then the tail is wagging the dog. But anyone masochistic enough to stick with Spring testing at this point is probably a good candidate for buying a book about it, so you might want to get into how to do that.

    Note: I modified the formatting of your comment so that looks a bit prettier. I didn’t remove anything essential. I hope that you don’t mind! – Petri

    Reply
    • Hi John,

      Thank you for your comment! It is nice to get “critical” feedback about the Spring MVC Test framework because it helps me to identify the problems which cause the most pain to the developers who write tests for Spring MVC applications.

      I agree that the lack of proper JSP support is disappointing but you can use other frameworks if you want to write “proper” end-to-end tests for your application. I think that it would be interesting to describe this in my book (or maybe I write a blog post about this).

      About your second point, I have written a blog post which describes how you can write integration tests for a Spring MVC application which uses either url or method security.

      Maybe that blog post can help you out. If not, it would be interesting to know what did you mean when you said: “no direct support for Spring Security” (although you cannot test Spring Security tags found from JSP pages).

      Again, thank you for your comments. I got a few great ideas for my book.

      Reply
  • I’m a big fan of testing. I would like a book to demonstrate TDD for a DDD approach to build a complete enterprise application.

    I also want to hear the analysis and comparison between different testing stategies for the same layer.

    When will you publish that book?

    Reply
    • Hi,

      thanks for sharing your opinion! I really appreciate it.

      I don’t have a tight schedule for this book since I mostly write it on my free time. The first step is write the example applications. When this is done, I will start writing the book.

      I am planning to write the example applications during my summer holiday (it is in July).

      Reply
  • Oh! I just discovered your website, I read through the Spring Data JPA tutorial and I found it amazing.
    and now I discovered you’re working on a book about Testing+Spring MVC! Amazing!
    Is there a way we can register for notifications when the book comes out? I want to be the first one to buy it! ^_^

    Thanks! I’m definitely adding your site to my bookmarks and RSS reader right away

    Reply
    • Thank you for your kind words. I really appreciate them.

      I discovered you’re working on a book about Testing+Spring MVC! Amazing!
      Is there a way we can register for notifications when the book comes out? I want to be the first one to buy it!

      At the moment there is no way to get a notification when the book is published. :( I will create an email newsletter next year and I guess that I could use it to advertise my testing book when it is done.

      In the meantime, you might want to take a look at my Spring MVC Test tutorial. It should help you to get started with Spring MVC Test. Also, if you encounter any problems, let me know and I will try to help you.

      Reply
  • Hi Petri,

    Can you include lots of examples running TestNg with MockMVC? TestNG does not have a SpringJunit runners like Junit, so the configuration using Testng is kinda tricky. Thanks.

    Reply
    • Hi Matt,

      Unfortunately I have never used TestNg in a real-life software project. In fact, I have written only a few simple unit tests with it. That is why the examples of my upcoming video course will use JUnit.

      Reply
  • I am just wondering when this book will be out. I have been waiting for it since December 2014. Or was the book replaced but the video course?

    Reply
    • Hi,

      Unfortunately this book won’t be out anytime soon (due to some legal issues that prevent me from writing it). That is why I decided to replace a book with an online course that provides both text and video lessons.

      Reply

Leave a Comment