Transcripted Summary

This chapter provides an overview of the prerequisites required to integrate Jenkins into test automation frameworks.



We will look at an existing project that uses Selenium, Java, TestNG, and Maven.

To learn how to create Maven projects for Java, TestNG, and Selenium, please check out other courses by TAU instructors Angie Jones and Rex Jones II.

In this example I am using the Eclipse IDE. You are welcome to use any IDE that you are comfortable with.

This is a simple project called "CI_course_project". It defines one test class containing a single test that launches the Test Automation University website and verifies its header.




package training;

import org.testng.annotations.Test;
import org.testng.AssertJUnit;
import org.testng.annotations.Test;
import org.testng.AssertJUnit;
import org.testng.annotations.Test;
import org.testng.AssertJUnit;
import org.openqa.selenium.By;   	 
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;   	 
import org.testng.Assert;   	 
import org.testng.annotations.Test;    
import org.testng.annotations.BeforeTest;    
import org.testng.annotations.AfterTest;   	 



public class FirstSeleniumJavaTest {

    private WebDriver driver;   	 
    @Test   			 
    public void testEasy() {

        driver.get("https://testautomationu.applitools.com/");
        driver.manage().window().maximize();

        String title = driver.getTitle();
        AssertJUnit.assertTrue(title.equals("Test Automation University | Applitools"));
    }    

    @Test   			 
    public void testTwo() {    

        driver.get("https://www.google.co.uk/");
        driver.manage().window().maximize();

        String title1 = driver.getTitle();
        System.out.println("title is "+title1);
        AssertJUnit.assertTrue(title1.equals("Google"));
    }

    @BeforeTest
    public void beforeTest() {    
        driver = new ChromeDriver();  
    }
   	 
    @AfterTest
    public void afterTest() {
        driver.quit();   		 
    }    
}



Resources



Quiz

The quiz for this chapter can be found in section 3.7

© 2024 Applitools. All rights reserved. Terms and Conditions Privacy Policy GDPR