Home > Store > Programming > Java
Next Generation Java Testing: TestNG and Advanced Concepts
- By Cédric Beust, Hani Suleiman
- Published Oct 15, 2007 by Addison-Wesley Professional.
- Copyright 2008
- Dimensions: 7x9-1/4
- Pages: 512
- Edition: 1st
- Book
- ISBN-10: 0-321-50310-4
- ISBN-13: 978-0-321-50310-7
Register your product to gain access to bonus material or receive a coupon.
Enterprise Java developers must achieve broader, deeper test coverage, going beyond unit testing to implement functional and integration testing with systematic acceptance. Next Generation Java™ Testing introduces breakthrough Java testing techniques and TestNG, a powerful open source Java testing platform.
Cédric Beust, TestNG's creator, and leading Java developer Hani Suleiman, present powerful, flexible testing patterns that will work with virtually any testing tool, framework, or language. They show how to leverage key Java platform improvements designed to facilitate effective testing, such as dependency injection and mock objects. They also thoroughly introduce TestNG, demonstrating how it overcomes the limitations of older frameworks and enables new techniques, making it far easier to test today's complex software systems.
Pragmatic and results-focused, Next Generation Java™ Testing will help Java developers build more robust code for today's mission-critical environments.
This book
- Illuminates the tradeoffs associated with testing, so you can make better decisions about what and how to test
- Introduces TestNG, explains its goals and features, and shows how to apply them in real-world environments
- Shows how to integrate TestNG with your existing code, development frameworks, and software libraries
- Demonstrates how to test crucial code features, such as encapsulation, state sharing, scopes, and thread safety
- Shows how to test application elements, including JavaEE APIs, databases, Web pages, and XML files
- Presents advanced techniques: testing partial failures, factories, dependent testing, remote invocation, cluster-based test farms, and more
- Walks through installing and using TestNG plug-ins for Eclipse, and IDEA
- Contains extensive code examples
Whether you use TestNG, JUnit, or another testing framework, the testing design patterns presented in this book will show you how to improve your tests by giving you concrete advice on how to make your code and your design more testable.
|
30 of 34 people found the following review helpful
By Jeanne Boyarsky (New York, NY) - See all my reviews
This review is from: Next Generation Java Testing: TestNG and Advanced Concepts (Paperback)
"Next Generation Java Testing" has a subtitle: "TestNG and Advanced Concepts." This isn't surprising given the creator of TestNG is an author, but is important to realize. It starts with 6.5 pages on why TestNG is better than JUnit 3.8. Then only two paragraphs on JUnit 4. This has been a pet peeve of mine for some time. It's like comparing the current version of C# to Java 1.3 and then saying Java is worse because it doesn't have generics.I liked the code snippets in the TestNG sections as they focused on relevant pieces. The examples were to the point. Especially the performance and J2EE sections. I liked the concepts described in chapter 2 (over 100 pages.) The authors describe open source libraries that integrate with TestNG. I liked this coverage although JMock could have used a code example for comparison (easyMock had one.) Ant targets were provided for the code coverage examples. Chapter seven is titled "digressions." Some quotes... Read more
17 of 20 people found the following review helpful
By
Amazon Verified Purchase(What's this?)
This review is from: Next Generation Java Testing: TestNG and Advanced Concepts (Paperback)
This was not the book I expected, but it makes a lot of sense that it turned out this way. Cedric is like the Martin Luther of the testing world. I ranted about a lot of the same things in JUnit, especially for instance, the whole crazy TestDecorator business, but Cedric just blew the house down. TestNG, after JUnit, was like getting out of jail.So it makes sense that this book is a kind of exhaustive compendium of testing approaches, and as such, it succeeds, in most ways. There are a few things that don't show up, for instance, there is discussion of container testing, but Shale is not mentioned (unit testing JSF is made much better by it, and JSF is part of JEE5 so it deserves attention). The section on testing XML was good, considering dom4j, XMLUnit, etc., but it ends too quickly. For instance, what about using XPath statements? or some schema tools? Given that Cedric's partner in crime, of Bileblog fame, was aboard for this outing, rants were bound to... Read more
8 of 9 people found the following review helpful
By
This review is from: Next Generation Java Testing: TestNG and Advanced Concepts (Paperback)
At last a book that deals with testing applications (in java) that seems to be written by author's who have worked with real life, non trivial projects(TDD with adding two money objects together, anyone?).This book describes using TestNG along with some advanced TestNG concepts and goes on to show how to use the framework to test out JEE projects. There are also chapters showing the developer how to integrate TestNG with other frameworks (like spring, DBUnit, jwebunit etc) which is useful as this is perhaps the only place where JUnit is better than TestNG. Inspite of the fact that TestNG documentation is pretty good, this book is worthwile buying (even if you use JUnit as your testing tool of choice). There is useful coding and refactoring advice along the way(also a commentary on TDD), and a miscellaneous chapter of sorts which seems to have been written by Hani and edited by Cedric to remove all profanities!. I do hope the author's expand the testing enterprise... Read more |
› See all 11 customer reviews...
Online Sample Chapter
Index
Preface
Foreword
Table of Contents
Foreword xiii
Preface xv
Acknowledgments xxi
About the Authors xxiii
Chapter 1: Getting Started 1
- Beyond JUnit 3 3
JUnit 4 7
Designing for Testability 8
TestNG 17
Conclusion 21
Chapter 2: Testing Design Patterns 23
- Testing for Failures 23
Factories 34
Data-Driven Testing 39
Asynchronous Testing 67
Testing Multithreaded Code 71
Performance Testing 83
Mocks and Stubs 90
Dependent Testing 103
Inheritance and Annotation Scopes 113
Test Groups 119
Code Coverage 132
Conclusion 150
Chapter 3: Enterprise Testing 153
- A Typical Enterprise Scenario 154
A Concrete Example 157
Test Implementation 160
Exploring the Competing Consumers Pattern 182
The Role of Refactoring 186
Conclusion 194
Chapter 4: Java EE Testing 197
- In-Container versus Out-of-Container Testing 198
In-Container Testing 200
Java Naming and Directory Interface (JNDI) 207
Java Database Connectivity (JDBC) 210
Java Transaction API (JTA) 215
Java Messaging Service (JMS) 219
Java Persistence API (JPA) 225
Enterprise Java Beans 3.0 (EJB3) 236
Java API for XML Web Services (JAX-WS) 246
Servlets 255
XML 262
Conclusion 266
Chapter 5: Integration 269
- Guice 280
DbUnit 295
HtmlUnit 303
Selenium 310
Swing UI Testing 312
Tests for Painting Code 316
Continuous Integration 320
Conclusion 322
Chapter 6: Extending TestNG 325
- The TestNG API 325
BeanShell 335
Method Selectors 341
Annotation Transformers 346
Reports 355
Writing Custom Annotations 366
Conclusion 375
Chapter 7: Digressions 377
- Motivation 377
The TestNG Philosophy 378
The Care and Feeding of Exceptionsv378
Stateful Tests 382
The Pitfalls of Test-Driven Development 385
Testing Private Methods 388
Testing versus Encapsulation 391
The Power of Debuggers 392
Logging Best Practices 394vThe Value of Time 397
Conclusion 399
Appendix A: IDE Integration 401
- Eclipse 401
IntelliJ IDEA 411
Appendix B: TestNG Javadocs 421
- JDK 1.4 and JDK 5 421
Shortcut Syntax for JDK 5 Annotations 423
Annotation Javadocs 423
The org.testng.TestNG Class 428
The XML API 432
Appendix C: testng.xml 435
- Overview 436
Scopes 437
XML Tags 437
Appendix D: Migrating from JUnit 449
- JUnitConverter 449
Integrated Development Environments 453
Incremental Migration and JUnit Mode 455
Converting JUnit Code 456
Index 471
Downloadable Sample Chapter

This book includes free shipping!
This book includes free shipping!

eBook (Watermarked)
$47.99
$38.39
Includes EPUB and PDF
About eBook Formats
This eBook includes the following formats, accessible from your Account page after purchase:
PDFThe popular standard, used most often with the free Adobe® Reader® software.
EPUBThe open industry format known for its reflowable content and usability on supported mobile devices.
This eBook requires no passwords or activation to read. We customize your eBook by discretely watermarking it with your name, making it uniquely yours.
- Request an Instructor or Media review copy.
- Corporate, Academic, and Employee Purchases
- International Buying Options
Get access to thousands of books and training videos about technology, professional development and digital media from more than 40 leading publishers, including Addison-Wesley, Prentice Hall, Cisco Press, IBM Press, O'Reilly Media, Wrox, Apress, and many more. If you continue your subscription after your 30-day trial, you can receive 30% off a monthly subscription to the Safari Library for up to 12 months. That's a total savings of $199.




