Monday, February 13, 2017

TestNG - Creating new TestNG New Test File

TestNG  - Test Case Writing 

Setting up the new TestNG project 

Step 1 - File ⇨ New ⇨ JavaProject 


 Step 2 - Select the "Java Project" ⇨ Next



Step 3 - Give the Project Name ⇨ Select "Use defult JPE"⇨Select the "Create Separate folders for sources and class files" ⇨ Click on "Finish"⇨ Then It will create the Java project 



Step 4  - Import the TestNG Libraries onto our project 
              Right click on Project ⇨ Build Path ⇨ Configure Buid Path ... 


              Go to the "Libraries" tab ⇒ Click on  "Add Libraries" ⇨ Select TestNG ⇨ Next ⇨ Finish



   

TestNG - Environment Set - Up

   TestNG  -  Environment Set-Up 


Step 1  -  Launch Eclipse ⇨ Navigate to the Menu bar ⇨ Click on Help ⇨ Select the "Install New Software"



Step 2 - In the install dialog box ,Click the Add button⇨"Add Repository " will be appear ⇨ Add the Name as "TestNG"⇨Add the Location as "http://beust.com/eclipse"⇨ Click on OK



Step 3  - Check the TestNG  



Step 4 - Click on Radio button  "I Accept the terms of the license agreement " ⇨ Click on Finish


Step 5  - Wait for installation finish 

Step 6  - If you encounter the security warring Just OK 


Step 7  -  When Eclipse prompts you for a restart, just click Yes 



TestNG - Overview

TestNG  - Overview 

Introduction 

  • TestNG is a testing faramework
  • TestNG means Test Next Generation 
  • TestNG is an Open source automation testing framework
  • Developed base on Junit & Nunit 
  • Designed to cover all categories of tests : unit,functional,end-to-end,integration
  • Flexible plug-in API
  • Support for multithreaded testing

Shortcomings of Earlier FWs

  • Initially designed to enable unit testing only.now used foe all kinds of testing .
  • Cannot do dependency testing 
  • Poor configuration controls(setUp/tearDown)
  •  Intrusive (name your methods a certain way)
  • The management of different suites of tests in complex projects can be very tricky .

Advantage of TestNG over Junit

  1. Annotations are easier to undestand 
  2. Test cases can be grouped more easily
  3. Parallel testing is possible

Why do we need TestNG in selenium ?

  • TestNG can generate reports based on our selenium test results.
  • WebDriver has no native mechanism for generating reports.
  • TestNG can generate the report in a readable format.
  • There is no more need for a static main method in our tests.the sequence of action is regulated by easy to understand annotations that do not require method to be static.
  • Uncaught exception are automatically handled by TestNG without terminating the test prematurely .These exception are reported as failed steps in the report 

MS VISUAL STUDIO CODEDUI TEST FRAMEWORK AND TEST EXECUTION

MS VISUAL STUDIO CODEDUI TEST FRAMEWORK AND TEST EXECUTION  1.0 Pre-Requisites for the execution 1.1 Software Requirements ...