在2014年中针对Java单元测试框架的9本最好书籍

jopen 10年前

1. Mastering Unit Testing Using Mockito and JUnit

mastering_junit_and_mockito.jpgAuthor: Sujoy Acharya

Publisher: Packt Publishing

Published Date: July 15, 2014

Paperback: 310 pages

Read Full Customer Reviews

Content Coverage:

  • Chapter 1: JUnit - A Total Recall
    • Defining unit testing
    • Working with JUnit 4
    • Working with JUnit 4++
    </li>
  • Chapter 2: Automating JUnit Tests
  • </ul>
      • Continuous Integration
      • Jenkins
      </li>
    • Chapter 3: Test Doubles
    • </ul>
        • Dummy, Stub, Fake, Mock, Spy
      • Chapter 4: Progressive Mockito
        • Working with Mockito
        • Drinking Mockito
        </li>
      • Chapter 5: Exploring Code Coverage
        • Understanding code coverage
        • Configuring Eclipse plugin
        • Measuring code coverage using Gradle
        • Working with the Maven Cobertura plugin
        • Running the Cobertura Ant task
        • </ul> </li>
        • Chapter 6: Revealing Code Quality
        • </ul>
            • Understanding the static code analysis
            • Working with the Checkstyle plugin
            • Exploring the FindBugs plugin
            • Working with the PMD plugin
            • Monitoring code quality with SonarQube
            • Getting familiar with false positives
            </li>
          • Chapter 7: Unit Testing the Web Tier
            • Unit testing servlets
            • Playing with Spring MVC
            • </ul> </li>
            • Chapter 8: Playing with Data
              • Separating concerns
              • Unit testing the persistence logic
              • Simplifying persistence with Spring
              • Verifying the system integrity
              • Writing integration tests with Spring
              • </ul> </li>
              • Chapter 9: Solving Test Puzzles
                • Working with the legacy code
                • Designing for testability
                • Working with greenfield code
                • </ul> </li>
                • Chapter 10: Best Practices
                  • Writing meaningful tests
                  • Automating JUnit tests
                  • Configuring tests
                  • Working with assertions
                  • Handling exceptions
                  • Working with test smells
                  • </ul> </li> </ul>

                    More information about Mastering Unit Testing Using Mockito and JUnit on Amazon


                    2. Practical Unit Testing with JUnit and Mockito

                    practical_unit_testing.jpgAuthor: Tomek Kaczanowski

                    Publisher: Tomasz Kaczanowski

                    Published Date: April 23, 2013

                    Paperback: 402 pages

                    Read Full Customer Reviews

                    Content Coverage:

                    • I. Developers’ Tests
                      • On Tests and Tools
                      • Unit Tests
                      </li>
                    • II. Writing Unit Tests
                      • Unit Tests with no Collaborators
                      • Test Driven Development
                      • Mocks, Stubs, Test Spies
                      • </ul> </li>
                      • III. Hints and Discussions
                        • Things You Should Know
                        • Points of Controversy
                        • </ul> </li>
                        • IV. Listen and Organize
                        • </ul>
                            • Getting Feedback
                            • Organization of Tests
                            </li>
                          • V. Make them Better
                            • Maintainable Tests
                            • Test Quality
                            • </ul> </li>
                            • A. Automated Tests
                              • Wasting Your Time by not Writing Tests
                              • When and Where Should Tests Run?
                              • </ul> </li>
                              • B. Running Unit Tests
                              • </ul>
                                  • Running Tests with Eclipse
                                  • Running Tests with IntelliJ IDEA
                                  • Running Tests with Gradle
                                  • Running Tests with Maven
                                  </li>
                                • C. Test Spy vs. Mock
                                  • Different Flow - and Who Assert?
                                  • Stop with the First Error
                                  • Stubbing
                                  • Forgiveness
                                  • Different Threads or Containers
                                  • Conclusions
                                  • </ul> </li> </ul>

                                    More information about Practical Unit Testing with JUnit and Mockito on Amazon

                                     


                                    3. Mockito Cookbook

                                    mockito_cookbook.jpgAuthor: Marcin Grzejszczak

                                    Publisher: Packt Publishing

                                    Published Date: June 24, 2014

                                    Paperback: 264 pages

                                    Read Full Customer Reviews

                                    Content Coverage:

                                    • Chapter 1: Getting Started with Mockito
                                      • Mockito for JUnit and TestNG
                                      • Mockito best practices
                                      </li>
                                    • Chapter 2: Creating Mocks
                                      • Creating mocks in code, with annotations
                                      • Creating mocks with different default answer
                                      • </ul> </li>
                                      • Chapter 3: Creating Spies and Partial Mocks
                                        • Creating spies in code
                                        • Creating spies with custom configuration
                                        • </ul> </li>
                                        • Chapter 4: Stubbing Behavior of Mocks
                                          • Using argument matchers for stubbing
                                          • Stubbing methods that return values
                                          • Stubbing methods that they throw exceptions
                                          • </ul> </li>
                                          • Chapter 5: Stubbing Behavior of Spies
                                          • </ul>
                                              • Stubbing methods that return values
                                              • Stubbing void methods
                                              </li>
                                            • Chapter 6: Verifying Test Doubles
                                            • </ul>
                                                • Verifying the method invocation count with times()
                                                • Verifying the method invocation count with atLeast()
                                                </li>
                                              • Chapter 7: Verifying Behavior with Object Matchers
                                                • Using Hamcrest matchers for assertions
                                                • Creating custom Hamcreast matchers
                                                • </ul> </li>
                                                • Chapter 8: Refactoring with Mockito
                                                  • Removing the problems with instance creation
                                                  • Refactoring classes that do too much
                                                  • </ul> </li>
                                                  • Chapter 9: Integration Testing with Mockito and DI Frameworks
                                                    • Injecting test doubles instead of beans using Spring’s code configuration
                                                    • Injecting test doubles instead of beans using Springockito
                                                    • </ul> </li>
                                                    • Chapter 10: Mocking Libraries Comparison
                                                      • Mockito versus EasyMock, JMockit, JMock and Spock
                                                      • </ul> </li> </ul>

                                                        More information about Mockito Cookbook on Amazon


                                                        4. Selenium WebDriver Practical Guide Paperback

                                                        seleninum_webdriver.jpgAuthor: Satya Avasarala

                                                        Publisher: Packt Publishing

                                                        Published Date: January 24, 2014

                                                        Paperback: 264 pages

                                                        Read Full Customer Reviews

                                                        Content Coverage:

                                                        • Chapter 1: Introduction to WebDriver and WebElements
                                                          • Understanding the history of Selenium
                                                          • Setting up a project in Eclipse
                                                          </li>
                                                        • Chapter 2: Exploring Advanced Interactions of WebDriver
                                                          • Understanding actions, build and perform
                                                          • </ul> </li>
                                                          • Chapter 3: Exploring the Features of WebDriver
                                                          • </ul>
                                                              • Setting the desired capabilities for a browser
                                                              • Taking screenshots
                                                              • Locating target windows and iFrames
                                                              • Exploring Navigate
                                                              • Waiting for WebElements to load
                                                              • Handling cookies
                                                              </li>
                                                            • Chapter 4: Different Available WebDrivers
                                                              • FirefoxDriver
                                                              • InternetExplorerDriver
                                                              • ChromeDriver
                                                              • SafariDriver
                                                              • OperaDriver
                                                              • </ul> </li>
                                                              • Chapter 5: Understanding WebDriver Events
                                                                • Introducing EventFiringWebDriver and EventListener classes
                                                                • Creating an instance of EventListener
                                                                • Exploring different WebDriver event listeners
                                                                • </ul> </li>
                                                                • Chapter 6: Dealing with I/O
                                                                • </ul>
                                                                    • Learning about the FileHandler class
                                                                    • Learning about the TemporaryFilesystem class
                                                                    • Learning about the Zip class
                                                                    </li>
                                                                  • Chapter 7: Exploring RemoteWebDriver and WebDriverBackedSelenium
                                                                  • </ul>
                                                                      • Introducing RemoteWebDriver
                                                                      • Understanding the JSON wire protocol
                                                                      • Replacing the client library with your own code
                                                                      • Exploring WebDriverBackedSelenium
                                                                      </li>
                                                                    • Chapter 8: Understanding Selenium Grid
                                                                      • Exploring Selenium Grid
                                                                      • Understanding the hub
                                                                      • Understandind the node
                                                                      • Modifying the existing test script to use Selenium Grid
                                                                      • Configuring Selenium Grid
                                                                      • </ul> </li>
                                                                      • Chapter 9: Understanding PageObject Pattern
                                                                        • Creating test cases for our Wordpress blog
                                                                        • What is the PageObject pattern?
                                                                        • Good practices for the PageObjects design
                                                                        • Understanding loadable components
                                                                        • Working on end-to-end example of Wordpress
                                                                        • </ul> </li>
                                                                        • Chapter 10: Testing iOS and Android Apps
                                                                        • </ul>
                                                                            • Different forms of mobile applications
                                                                            • Available software tools
                                                                            • Automating iOS and Android tests using Appium
                                                                            </li> </ul>

                                                                            More information about Selenium WebDriver Practical Guide on Amazon


                                                                            5. Performance Testing With JMeter 2.9

                                                                            jmeter_performance_testing.jpgAuthor: Bayo Erinle

                                                                            Publisher: Packt Publishing

                                                                            Published Date: July 26, 2013

                                                                            Paperback: 148 pages

                                                                            Read Full Customer Reviews

                                                                            Content Coverage:

                                                                            • Chapter 1: Performance Testing Fundamentals
                                                                              • The incident and aftermath
                                                                              • Performance testing and tuning
                                                                              • JMeter to the rescue
                                                                              </li>
                                                                            • Chapter 2: Recording Your First Test
                                                                              • Configuring JMeter HTTP proxy server
                                                                              • Setting up your browser to use the proxy server
                                                                              • Anatomy of a JMeter test
                                                                              • </ul> </li>
                                                                              • Chapter 3: Submitting Forms
                                                                                • Capturing simple forms
                                                                                • </ul> </li>
                                                                                • Chapter 4: Managing Sessions
                                                                                  • Managing sessions with cookies
                                                                                  • Managing sessions with URL rewriting
                                                                                  • </ul> </li>
                                                                                  • Chapter 5: Resource Monitoring
                                                                                  • </ul>
                                                                                      • Basic server monitoring
                                                                                      • Monitoring the server with a JMeter plugin
                                                                                      </li>
                                                                                    • Chapter 6: Distributed Testing
                                                                                      • Remote testing with JMeter
                                                                                      • Leveraging the cloud for distributed testing
                                                                                      • </ul> </li>
                                                                                      • Chapter 7: Helpful Tips
                                                                                      • </ul>
                                                                                          • JMeter properties and variables
                                                                                          • JMeter functions
                                                                                          • The Regular Expression tester
                                                                                          • The Debug sampler
                                                                                          • Using timers in your test plan
                                                                                          • The JDBC Request sampler
                                                                                          • A Dummy sampler
                                                                                          • The JSON Path Extractor element
                                                                                          • Handling RESTful web services
                                                                                          </li> </ul>

                                                                                          More information about Performance Testing With JMeter on Amazon


                                                                                          6. TestNG Beginner's Guide

                                                                                          testng_beginner_guide.jpgAuthor: Varun Menon

                                                                                          Publisher: Packt Publishing

                                                                                          Published Date: July 26, 2013

                                                                                          Paperback: 276 pages

                                                                                          Read Full Customer Reviews

                                                                                          Content Coverage:

                                                                                          • Chapter 1: Getting Started
                                                                                            • Features of TestNG
                                                                                            • Writing your first TestNG test
                                                                                            </li>
                                                                                          • Chapter 2: Understanding testng.xml
                                                                                            • Creating a test suite
                                                                                            • Running testng.xml
                                                                                            • </ul> </li>
                                                                                            • Chapter 3: Annotations
                                                                                              • Annotations in TestNG
                                                                                              • Before and After annotations
                                                                                              • </ul> </li>
                                                                                              • Chapter 4: Groups
                                                                                                • Grouping tests
                                                                                                • Running a TestNG group
                                                                                                • </ul> </li>
                                                                                                • Chapter 5: Dependencies
                                                                                                • </ul>
                                                                                                    • Dependency test
                                                                                                    • Using regular expression
                                                                                                    </li>
                                                                                                  • Chapter 6: The Factory Annotation
                                                                                                    • What is factory?
                                                                                                    • First factory test
                                                                                                    • </ul> </li>
                                                                                                    • Chapter 7: Parallelism
                                                                                                    • </ul>
                                                                                                        • Writing first parallel test
                                                                                                        • Running test methods in parallel
                                                                                                        </li>
                                                                                                      • Chapter 8: Using Build Tools
                                                                                                        • Build automation
                                                                                                        • Using Ant to run TestNG tests
                                                                                                        • </ul> </li>
                                                                                                        • Chapter 9: Logging and Reports
                                                                                                          • Writing your own logger
                                                                                                          • Writing your own reporter
                                                                                                          • </ul> </li>
                                                                                                          • Chapter 10: Creating a Test Suite through Code
                                                                                                            • Running TestNG programmatically
                                                                                                            • Parameterization of tests
                                                                                                            • </ul> </li>
                                                                                                            • Chapter 11: Migrating from JUnit
                                                                                                              • Running your JUnit tests through TestNG
                                                                                                              • Converting a JUnit test to a TestNG test
                                                                                                              • </ul> </li>
                                                                                                              • Chapter 12: Unit and Functional Testing
                                                                                                                • Unit testing with TestNG
                                                                                                                • Assertion with TestNG
                                                                                                                • </ul> </li>
                                                                                                                • Pop Quiz Answers
                                                                                                                • </ul>

                                                                                                                  More information about TestNG Beginner's Guide on Amazon

                                                                                                                   


                                                                                                                  7. Instant Mock Testing with PowerMock

                                                                                                                  powermock.jpgAuthor: Deep Shah

                                                                                                                  Publisher: Packt Publishing

                                                                                                                  Published Date: October 25, 2013

                                                                                                                  Paperback: 82 pages

                                                                                                                  Read Full Customer Reviews

                                                                                                                  Content Coverage:

                                                                                                                  • Saying Hello World! (simple)
                                                                                                                  • Getting and installing PowerMock (simple)
                                                                                                                  • Mocking static methods (simple)
                                                                                                                  • Verifying method invocation (simple)
                                                                                                                  • Mocking final classes or methods (simple)
                                                                                                                  • Mocking constructors (medium)
                                                                                                                  • Understanding arguments matchers (medium)
                                                                                                                  • Understanding the Answer interface (advanced)
                                                                                                                  • Partial mocking with spies (advanced)
                                                                                                                  • Mocking private methods (advanced)
                                                                                                                  • Breaking the encapsulation (advanced)
                                                                                                                  • Suppressing unwanted behavior (advanced)

                                                                                                                  More information about Instant Mock Testing with PowerMock on Amazon


                                                                                                                  8. Arquillian Testing Guide

                                                                                                                  arquillian_testing_guide.jpgAuthor: John D. Ament

                                                                                                                  Publisher: Packt Publishing

                                                                                                                  Published Date: April 17, 2013

                                                                                                                  Paperback: 242 pages

                                                                                                                  Read Full Customer Reviews

                                                                                                                  Content Coverage:

                                                                                                                  • Chapter 1: The Aliens Have Landed!
                                                                                                                    • The progressions of testing
                                                                                                                    • What is Arquillian
                                                                                                                    </li>
                                                                                                                  • Chapter 2: The Evolution of Testing
                                                                                                                  • </ul>
                                                                                                                      • How did we get here?
                                                                                                                      • A jump in technology
                                                                                                                      </li>
                                                                                                                    • Chapter 3: Container Testing
                                                                                                                      • Containers and deployments
                                                                                                                      • </ul> </li>
                                                                                                                      • Chapter 4: Why Did the Test Fail?
                                                                                                                        • Running your tests - the downside
                                                                                                                        • </ul> </li>
                                                                                                                        • Chapter 5: Enriching the Enterprise Test Case
                                                                                                                          • Testing the dependency injection
                                                                                                                          • Failure scenarios
                                                                                                                          • </ul> </li>
                                                                                                                          • Chapter 6: Arquillian Extensions
                                                                                                                            • Extending Arquillian
                                                                                                                            • Testing against a database using JPA
                                                                                                                            • </ul> </li>
                                                                                                                            • Chapter 7: Functional Application Testing
                                                                                                                              • Functional testing
                                                                                                                              • </ul> </li>
                                                                                                                              • Chapter 8: Service Testing
                                                                                                                                • Service testing approaches
                                                                                                                                • </ul> </li>
                                                                                                                                • Chapter 9: Arquillian and OSGi
                                                                                                                                  • OSGi and Arquillian
                                                                                                                                  • </ul> </li>
                                                                                                                                  • Chapter 10: ShrinkWrap in Action