TestNG Beginner's Guide


TestNG Beginner's Guide
eBook: $26.99
Formats: PDF, PacktLib, ePub and Mobi formats
$22.94
save 15%!
Print + free eBook + free PacktLib access to the book: $71.98    Print cover: $44.99
$44.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • Step-by-step guide to learn and practise any given feature
  • Detailed understanding of the features and core concepts
  • Learn about writing custom reporting

Book Details

Language : English
Paperback : 276 pages [ 235mm x 191mm ]
Release Date : July 2013
ISBN : 1782166009
ISBN 13 : 9781782166009
Author(s) : Varun Menon
Topics and Technologies : All Books, Application Development, Beginner's Guides, Open Source

Table of Contents

Preface
Chapter 1: Getting Started
Chapter 2: Understanding testng.xml
Chapter 3: Annotations
Chapter 4: Groups
Chapter 5: Dependencies
Chapter 6: The Factory Annotation
Chapter 7: Parallelism
Chapter 8: Using Build Tools
Chapter 9: Logging and Reports
Chapter 10: Creating a Test Suite through Code
Chapter 11: Migrating from JUnit
Chapter 12: Unit and Functional Testing
Pop Quiz Answers
Index
  • Chapter 1: Getting Started
    • Testing and test automation
    • TestNG
    • Features of TestNG
    • Downloading TestNG
      • Prerequisites
    • Installing TestNG onto Eclipse
    • Time for action – installing TestNG onto Eclipse
    • Writing your first TestNG test
      • The Java project
    • Time for action – creating a Java project
    • Time for action – creating your first TestNG class
    • Running your first test program
    • Time for action – running tests through Eclipse
    • Summary
    • Chapter 2: Understanding testng.xml
      • About testng.xml
      • Creating a test suite
      • Time for action – creating a test suite
      • Running testng.xml
        • Using command prompt
      • Time for action – running testng.xml through the command prompt
        • Using Eclipse
      • Time for action – executing testng.xml using Eclipse
      • Time for action – configuring Eclipse to run a particular TestNG XML file
      • Creating multiple tests
      • Time for action – testng XML with multiple tests
      • Adding classes, packages, and methods to test
        • Sample project
        • Creating a test with classes
      • Time for action – creating a test with classes
        • Creating a test using packages
      • Time for action – creating a test with packages
        • Creating a test with methods
      • Time for action – creating a test with methods
        • Creating a test with packages, classes, and methods
      • Time for action – creating a test suite with package, class, and test method
      • Including and excluding
        • Include/exclude packages
      • Time for action – test suite to include a particular package
      • Time for action – test suite to exclude a particular package
        • Include/exclude methods
      • Time for action – test suite to exclude a particular method
        • Using regular expressions to include/exclude
          • Prerequisite – creating a sample project
      • Time for action – using regular expressions for test
      • Summary
      • Chapter 3: Annotations
        • Annotations in TestNG
        • Before and After annotations
        • Time for action – running the Before and After annotations
        • Time for action – Before and After annotation when extended
        • Test annotation
        • Time for action – using test annotation on class
        • Disabling a test
        • Time for action – disabling a test method
        • Exception test
        • Time for action – writing an exception test
        • Time for action – writing a exception test verifying message
        • Time test
        • Time for action – time test at suite level
        • Time for action – time test at test method level
        • Parameterization of test
          • Parameterization through testng.xml
        • Time for action – parameterization through testng.xml
        • Time for action – providing optional values
        • DataProvider
        • Time for action – using Test annotation on Class
        • Time for action – DataProvider in different class
        • Summary
        • Chapter 4: Groups
          • Grouping tests
          • Time for action – creating test that belong to a group
          • Running a TestNG group
            • Using Eclipse
          • Time for action – running a TestNG group through Eclipse
            • Using the testng XML
          • Time for action – running a TestNG group using the testng XML
          • Test that belong to multiple groups
          • Time for action – creating a test having multiple groups
          • Including and excluding groups
          • Time for action – including/excluding groups using the testng XML
          • Using regular expressions
          • Time for action – using regular expressions in the testng XML
          • Default group
          • Time for action – assigning a default group to a set of tests
          • Group of groups
          • Time for action – running a TestNG group using the testng XML
          • Summary
          • Chapter 5: Dependencies
            • Dependency test
              • Test with single test method dependency
            • Time for action – creating a test that depends on another test
              • Test that depends on multiple tests
            • Time for action – creating a test that depends on multiple tests
              • Inherited dependency test
            • Time for action – creating a test that depends on inherited tests
            • Dependent groups
            • Time for action – creating a test that depends on a group
              • Depending on methods from different classes
            • Time for action – depending on a method from a different class
            • Using regular expressions
            • Time for action – using regular expressions
            • XML-based dependency configuration
              • Simple group dependency
            • Time for action – using simple dependency in XML
              • Multigroup dependency
            • Time for action – defining multigroup dependency in XML
              • Using regular expressions for defining dependency
            • Time for action – using regular expressions for dependency
            • Summary
            • Chapter 6: The Factory Annotation
              • What is factory?
                • First factory program
              • Time for action – first factory test
              • Passing parameters to test classes
              • Time for action – passing parameters to test classes
              • Using DataProvider along with the @Factory annotation
              • Time for action – using DataProvider with Factory
              • DataProvider or Factory
              • Time for action – the DataProvider test
              • Time for action – the Factory test
              • Dependency with the @Factory annotation
              • Time for action – dependency with the @Factory annotation
              • Time for action – running a dependency test sequentially
              • Summary
              • Chapter 7: Parallelism
                • Parallelism
                  • A simple multithreaded test
                • Time for action – writing first parallel test
                • Running test methods in parallel
                • Time for action – running test methods in parallel
                • Running test classes in parallel
                • Time for action – running test classes in parallel
                • Running tests inside a suite in parallel
                • Time for action – running tests inside a suite in parallel
                • Configuring an independent test method to run in multiple threads
                • Time for action – running independent test in threads
                • Advantages and uses
                • Summary
                • Chapter 8: Using Build Tools
                  • Build automation
                    • Advantages of build automation
                  • Different build tools available
                    • Ant
                      • Installing Ant
                      • Using Ant
                  • Time for action – using Ant to run TestNG tests
                    • Different configurations to be used with TestNG task
                  • Maven
                    • Installing Maven
                    • Using Maven
                • Time for action – using Maven to run TestNG tests
                  • Different configurations to be used with Maven
                • Summary
                  • Chapter 9: Logging and Reports
                    • Logging and reporting
                    • Writing your own logger
                    • Time for action – writing a custom logger
                    • Writing your own reporter
                    • Time for action – writing a custom reporter
                    • TestNG HTML and XML report
                    • Time for action – generating TestNG HTML and XML reports
                    • Generating a JUnit HTML report
                    • Time for action – generating a JUnit report
                    • Generating a ReportNG report
                    • Time for action – generating a ReportNG report
                      • ReportNG configuration options
                    • Generating a Reporty-ng (former TestNG-xslt) report
                    • Time for action – generating a Reporty-ng report
                      • Configuration options for Reporty-ng report
                    • Summary
                    • Chapter 10: Creating a Test Suite through Code
                      • Running TestNG programmatically
                      • Time for action – running TestNG programmatically
                      • Parameterization of tests
                      • Time for action – passing parameter values
                      • Include and exclude
                        • Include/exclude methods
                      • Time for action – including test methods
                        • Include/exclude groups
                      • Time for action – including/excluding groups
                      • Dependency test
                      • Time for action – configuring a dependency test
                      • Summary
                      • Chapter 11: Migrating from JUnit
                        • Running your JUnit tests through TestNG
                        • Time for action – writing a JUnit test
                          • Running your JUnit Tests through TestNG using the testng XML
                        • Time for action – running JUnit tests through TestNG
                          • Running JUnit and TestNG tests together with TestNG XML
                        • Time for action – running JUnit and TestNG tests together
                        • Running JUnit tests along with TestNG through Ant
                        • Time for action – running JUnit and TestNG tests through Ant
                        • Migrating from JUnit to TestNG
                        • Time for action – converting a JUnit test to a TestNG test
                        • Summary
                        • Chapter 12: Unit and Functional Testing
                          • Unit testing with TestNG
                          • Time for action – unit testing with TestNG
                          • Assertion with TestNG
                          • Mocking
                            • Different mocking strategies
                          • Mocking with TestNG
                            • Jmock
                          • Time for action – using JMock with TestNG
                            • Mockito
                          • Time for action – using Mockito
                          • Functional testing
                          • TestNG with Selenium
                          • Time for action – using Selenium with TestNG
                          • Summary

                          Varun Menon

                          Varun Menon is a QA consultant with several years of experience in developing automation frameworks on various technologies and languages such as Java, JavaScript, Ruby, and Groovy. He has worked on web and mobile applications for some of the leading clients in the field of supply chain management, online photo books, video analytics, and market research. He blogs at http://blog.varunin.com and is active on Stack Overflow, Selenium, and robotium groups. He is also the author of an upcoming open source android automation tool Bot-bot, which has record and re-play features like Selenium. He currently holds the position of QA Architect at Pramati Technologies Private Limited, Hyderabad, India.
                          Sorry, we don't have any reviews for this title yet.

                          Code Downloads

                          Download the code and support files for this book.


                          Submit Errata

                          Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


                          Errata

                          - 1 submitted: last submission 02 Sep 2013

                          The following Bio in the About the Reviewers page:

                          Yagna Narayana Dandeis currently working as a Lead Software Engineer in Testing
                          at Komli Media, a digital advertising and technology company. She previously worked
                          as a QA Engineer at MapR Technologies. MapR Technologies focuses on engineering
                          game-changing, Map/Reduce-related technologies.
                          She has also worked as a Software Engineer at Symantec, helping consumers and
                          organizations secure and manage the information-driven world.

                           

                          Should be:

                          Yagna Narayana Dandeis currently working as a Lead Software Engineer in Testing
                          at Komli Media, a digital advertising and technology company. He previously worked
                          as a QA Engineer at MapR Technologies. MapR Technologies focuses on engineering
                          game-changing, Map/Reduce-related technologies.
                          He has also worked as a Software Engineer at Symantec, helping consumers and
                          organizations secure and manage the information-driven world.

                          Sample chapters

                          You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                          Frequently bought together

                          TestNG Beginner's Guide +    Microsoft Forefront UAG 2010 Administrator's Handbook =
                          50% Off
                          the second eBook
                          Price for both: $44.09

                          Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                          What you will learn from this book

                          • Learn about TestNG and its advantages over other frameworks
                          • Configure/write test-suites in TestNG
                          • Learn about different Before/After annotations and how to use each one of them
                          • Pass values to your tests at runtime and make Data-driven tests
                          • Run tests in parallel
                          • Define and configure test-suites at runtime
                          • Extend TestNG to handle test-execution and generate custom reports.
                          • Include and exclude tests based on the search criteria to your test-suite

                          In Detail

                          Unit/Functional testing has now become part of every development life cycle. Junit was once the main framework that was used by developers for the purpose of Unit testing when it came to Java. But Junit had certain limitations in terms of execution and features. This book explains about the features and usage of TestNg, a new framework that overcomes Junit’s limitations and provides a lot of extra features.

                          TestNg Beginner’s Guide is a practical, hands-on guide that aims to increase your knowledge of TestNg. This step-by-step guide will help you to learn and understand the different TestNg features, and you will learn about the advantages and how to use and configure each feature according to your needs.

                          This book explains the various features of the TestNG testing framework. It provides a step-by-step guide that explains the different features with practical examples and sample programs.You will also learn about how to use and configure each feature based on different test scenarios. We will also take a look at extending TestNG to add custom logging and test-reports. If you are a beginner in TestNG or test frameworks, then this book will help you in learning, practising, and getting started with TestNg.

                          Approach

                          This book is written in a friendly, beginner’s guide style with plenty of step-by-step instructions with appropriate examples.

                          Who this book is for

                          This book is great for developers and testers who are new to TestNg and want to learn how to use TestNG for writing their application as well as functional tests. This book assumes that you have experience in Java and OOPs concepts and have worked with certain IDE.

                          Code Download and Errata
                          Packt Anytime, Anywhere
                          Register Books
                          Print Upgrades
                          eBook Downloads
                          Video Support
                          Contact Us
                          Awards Voting Nominations Previous Winners
                          Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                          Resources
                          Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software