Book Image

TestNG Beginner's Guide

By : Varun Menon
Book Image

TestNG Beginner's Guide

By: Varun Menon

Overview of this book

<p>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.</p> <p>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. <br /><br />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.</p>
Table of Contents (21 chapters)
TestNg Beginner's Guide
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Index

Running testng.xml


In the earlier section we had created a testng.xml file but haven't yet verified it by running it. In this section we will learn how to run the testng.xml configuration file. There are multiple ways of running the testng.xml file as a TestNG suite.

Using command prompt

You can execute the testng.xml file through the command prompt. This also allows the use of multiple testng.xml files to execute simultaneously through TestNG. Before running a testng.xml suite through the command prompt, we need to compile our project code. However, compilation of project code using Java is out of the scope of this book and is not covered. Hence, we will use the class files compiled by Eclipse. The code compiled by Eclipse can be found under a folder named bin inside your Test Java project folder.

Tip

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere...