Discussions

News: Book Review: Next Generation Java Testing

  1. Book Review: Next Generation Java Testing (21 messages)

    "Next Generation Java Testing," written by Cedric Beust and Hani Suleiman, focuses on two primary subject areas: TestNG and the application of testing patterns. Programmers who can't use TestNG will still find the book useful because many of TestNG's capabilities are being adopted by other testing frameworks, and because the patterns explained in the book are applicable to making any codebase more testable. The book is written very well. Both Cedric and Hani are prolific writers, and they write with a style that is very information-rich and readable. They manage to communicate to readers of all levels: experienced programmers looking for "meat" and less-experienced programmers trying to understand how to leverage testing frameworks. The book opens with a discussion of Junit 3, the testing framework most commonly encountered in Java. It covers not only Junit's capabilities, but its flaws as well, which laid the groundwork for TestNG. The first chapter explains some of the mindsets used when writing code for testability, and also introduces TestNG. Believe it or not, after the first chapter, readers will be able to use TestNG to some degree, at least matching the normal uses one finds for Junit 3. This kind of content-rich delivery is what makes the book so useful. The second chapter, "Testing Design Patterns," walks through testing for failures (a concept that Junit tends to invert), data-driven testing, asynchronous and multithreaded testing, test groups, code coverage, and the use of mocks and stubs for code that isn't meant to be tested (or ready to be tested.) The first and second chapters together make up an impressive book in and of themselves. The third and fourth chapters ("Enterprise Testing" and "Java EE Testing," respectively) introduce the concept of testing in-container and out-of-container for enterprise Java applications. Most testing at this level focuses on integration – integration of simpler, unit-tested code into larger frameworks, or integration of legacy code into newer codebases (or vice versa.) Enterprise testing can be both easier and harder than unit testing. Chapter three introduces a methodology, participants, and a sample application flow used as the basis for tests – and also describes a way of testing the application flow, including many refactorings. The fourth chapter discusses how to test Java EE components in-container. It includes code to find TestNG tests in a web application, and walks through almost the entire Java EE specification – JMS, JTA, servlets, EJBs, JAX-WS, JDBC, and JNDI, for example, although even this list isn't complete. The fifth chapter, "Integration," covers extensions for Junit 3 and their use in TestNG. Examples include Spring, DbUnit, and HtmlUnit. Chapter six is about extending TestNG. The seventh chapter, "Digressions," looks at some of the other issues around testing: exception handling, stateful tests, test-driven pitfalls, private methods, encapsulation, debuggers, and logging. All in all, this book is extremely well-written, and is very useful as a reference not only for TestNG but for designing code that's easy to test. The authors speak from experience, both being advanced and senior developers, and they do so in such a way that the prose is very accessible to all readers. Highly recommended.

    Threaded Messages (21)

  2. Are there any free chapters?
  3. Not yet.
  4. Yes there is if you attended oopsla2007[ Go to top ]

    If you attended oopsla2007, they provide a book with sample chapters from many already published and coming soon books. In it, they offer chapter 3 of that book which I happen to be reading this morning. All I can tell you it's a very intersting and well written book.
  5. whither the netbeans plugin[ Go to top ]

    I seriously love TestNG, but the only decent IDE support I've seen for it is the eclipse plugin. All I know about is an outstandingly crappy, long-abandoned plugin for Netbeans 5.x, and a completely empty google code project. Is there any plan to improve the IDE support? For me, a test framework without IDE support is like an IDE without a compiler.
  6. Re: whither the netbeans plugin[ Go to top ]

    I seriously love TestNG, but the only decent IDE support I've seen for it is the eclipse plugin. All I know about is an outstandingly crappy, long-abandoned plugin for Netbeans 5.x, and a completely empty google code project. Is there any plan to improve the IDE support? For me, a test framework without IDE support is like an IDE without a compiler.
    There is very good IntelliJ support for TestNG. For me, IDE without IntelliJ == IDE without a compiler:-)
  7. Re: whither the netbeans plugin[ Go to top ]

    Hi Chuck, Yeah, I wish someone would step up and help out with a netbeans plugin! FYI IDEA 7 has TestNG support included out of the box, so its not even an external plugin anymore, but part of the product.
  8. you can use Testng with Netbeans[ Go to top ]

    you can use Testng with Netbeans http://blogs.sun.com/glassfishqa/entry/testng_with_netbeans
  9. I am sure your fellow #java op appreciated you posting this review to the Serverside epesh
  10. Instead of making a knee-jerk assumption that the review is biased, you could read the book yourself and then refute Joe's review.
  11. Testing is for suckers.
  12. Many project provide test method based on junit. Why not TestNG merge into Junit 4?
  13. I wonder if this book mentions anything about continuous integration or distributing long running tests across a topology of nodes. I know TestNG has some level of support for it, albeit primitive. With emergence of continuous integration, a vast majority of projects nowadays run rich suites of regression tests which take hours to complete. Ouch! Why wait hours when you can wait minutes? GridGain, with its 1.6.0 release, added full support for parallelizing and distributing JUnit3 or JUnit4 tests across the grid. By simply attaching @Gridify annotation to your regular JUnit TestSuite you will be able to break your TestSuites into sub-suites and run them in parallel on remote nodes - no extra ant scripts or deployment steps required (GridGain takes care of all deployment and class-loading automatically). Check out the documentation and coding examples here. Best, Dmitriy Setrakyan GridGain - Grid Computing Made Simple
  14. I wonder if this book mentions anything about continuous integration or distributing long running tests across a topology of nodes. I know TestNG has some level of support for it, albeit primitive.

    With emergence of continuous integration, a vast majority of projects nowadays run rich suites of regression tests which take hours to complete.

    Ouch! Why wait hours when you can wait minutes?
    Let the marketing begin.
  15. Agree. A bit of marketing. Despite being obviously biased on this subject I think distributed unit test execution on the grid is the next big thing in the testing. We are seeing almost daily how 1 hour test runs basically destroy the whole notion of continues integration making it mostly useless. Grid enabling of the build and unit testing specifically is the only possible solution to this problem, literally bar none. Nikita Ivanov. GridGain - Grid Computing Made Simple
  16. Is it possible to run distributed tests that use externalised test data? We have a number of data driven tests which first source test data using JDBC into a database before performing assertions on the state of the database afterwards. If you installed mysql etc on each node can you distribute this type of test?
  17. Is it possible to run distributed tests that use externalised test data? We have a number of data driven tests which first source test data using JDBC into a database before performing assertions on the state of the database afterwards. If you installed mysql etc on each node can you distribute this type of test?
    Absolutely! GridGain makes not restrictions about your tests at all. Just think of them as your local tests. GridGain also gives you advanced support for test sequencing, so you can sequence your tests as you like, even on remote nodes, by simply properly grouping them into regular JUnit TestSuites. You can watch the online demo here Best, Dmitriy Setrakyan GridGain - Grid Computing Made Simple
  18. So, Nikita and Dmitriy, how did you like our book? -- Cedric
  19. So, Nikita and Dmitriy, how did you like our book?

    --
    Cedric
    Hi Cedric, Book is on its way :-) So, can't comment on it yet. As far as TestNG – I wish we could all switch to it. TestNG grid-enabling is high on our to-do list and I know you guys looked at it already. Best, Nikita Ivanov. GridGain – Grid Computing Made Simple
  20. Cedric, I've just received the book 2 days ago and now I'm reading chapter 1. My first feeling is the book is written well, short but concise :-) But I cannot find where to download the source code for the book. Can you help me to kkow where can I get it? Thanks. --- t800t8
  21. "Next Generation Java Testing"? I am in the JUnit generation.
  22. electronic (pdf) version[ Go to top ]

    IS there any place I can buy a pdf version of this book? (It is so much easier to work with a pdf than a hard copy) Please let me know. Thanks.