التخطي إلى المحتوى الرئيسي

المشاركات

عرض الرسائل ذات التصنيف TestNG Selenium Session by Shiva Sir

TEST NG in Selenium?

It is an Automation Framework that provides a set of annotations to create and execute a test script. It provides a structured approach to writing code that is easily understandable by automation developers. it provides a test script, test code, and annotation to write a program. It is upgraded from Web Driver and a modified form of JMeter. TestNG Command, Locators are similar to Web Drivers. TESNG Provides HTML Test REPORT With all Test methods separately. Type of Annotation:- @Test // it represents Test Method @Test void fun1() { } ........................................................................................................................... @BeforeTest:- This annotation will be executed before the Test Method, It will be declared only once in one Test Class. @AfterTest:- This annotation will be executed after the execution of all Test methods .it will be declared only once in one test case. @Test:- It is used to create a Test Case Method, We can create more than ...

TESTNG Installation and display report

1) O pen eclipse -----> Help---->  Eclipse Marketplace . 1.1)  A new window would open up, wherein you need to type “TestNG” in the Find text box and click on the Go button. 1.2)  You will now see the search results with TestNG for Eclipse at the top. All you need to do now is click on the Install button next to it. 1.3)  Select the “ Keep my installation the same ” option and again click on the  Confirm  button. After successfully installing res-start eclipse. 2)  Create New JAVA Project -----> Build Path---> Add Selenium JAR File- 3)  Build Path---> Add Library 4)  Create a Package and Create TestNG Class 5)   Right Click on TestNG Class and Run by TestNG 6)   Refresh the Project folder to right-click on the project and choose the refresh option. 7)   it will create test-output and open index.html to right-click on the file and show the report if TestNG is not installed then you can follow another installa...

Testng example to perform Integration Testing of Owner Module

 Test-ng example to perform  Integration Testing of Owner Module:- In this example, we will perform a complete integration testing operation from Owner Login with valid data and navigate to the dashboard page, click on add room options then click on the logout link. again create another test case to check login operation with invalid credentials. Code Specification:- 1)  uses two annotations of @Test to write test cases 2)  BeforeMethod annotation to execute Code before each Test case method and AfterMethod annotation to execute code after each test case. Complete Code Description:- package scs; import java.time.Duration; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.Select; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; public class TestNGExample...

Test Suite in TestNG

Test Suite in TestNG:- The test suite is used to execute more than one test class using a single XML file. Test Suite always will be defined by an XML file that contains multiple test classes using XML tag. First Create two different Test Case Classes  package scs; import org.testng.annotations.Test; import org.testng.annotations.BeforeTest; import org.testng.annotations.AfterClass; import org.testng.annotations.AfterSuite; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeSuite; public class Test1 { @BeforeClass public void bclass(){ System.out.println("Before Class1"); } @AfterClass public void aclass(){ System.out.println("After Class1"); } @BeforeSuite public void bsclass(){ System.out.println("Before SUIT1"); } @AfterSuite public void asclass(){ System.out.println("After Suit1"); }   @Test   public void f() {   System.o...

Groups in TestNG

Groups in TestNG:- It is used to logically subdivide the test case method, based on its usability.  to create a group, tesng provides "groups" attribute, and " beforegroups" and " aftergroups" annotation will be called for each grouping method. Example 1st:- package scs; import org.testng.annotations.*; public class TestNGExampleNew { @BeforeGroups("car")     public void bg1()     {            System.out.println("Car1");     }     @AfterGroups("car")     public void bg2()     {     System.out.println("Car2");     }    @Test(groups={"car"})    public void car1()    {    System.out.println("Car3");    }   @Test(groups={"car"})    public void car2()    {   System.out.println("Car4");    }   @Test(groups={"scooter"})    public void scooter1()    { ...