This library maintains api’s (common functions) which can be used to write platform independent End to End UI Tests against XL Release

This library uses selenium webdriver approach to act on browser as a normal user would do 

Sample

package xlrelease;

import com.xebialabs.pages.*;
import com.xebialabs.specs.BaseTest;
import com.xebialabs.specs.GlobalFunctions;

import org.testng.annotations.*;

/**
 * Sample class for testing most of the plugins via shared configuration
 * <p>
 *     To use this
 *      - just copy the same class into test module of the project
 *      - replace the methods defined below for relevant plugin types
 *      - Scenario 1 : OpenConfiguration - checks if you can open your configuration by title on Settings page of XL Release
 *      - Scenario 2 : SaveConfiguration - checks if you can save the configuration in XL Release
 *      - Scenario 3 : TestFortifyRelease - an example scenario explaining the ideal test for any plugin which uses shared configuration
 *      - Scenario 4 : TestCreateUserStory - an example scenario explaining the ideal test for any plugin which uses shared configuration
 * </p>
 * make sure you have back end integration running for your instance
 */
public class End2EndTests extends BaseTest {

    @BeforeMethod
    public void testStartUp(){
        LoginPage.login("admin","admin");
    }

    @Test
    public void OpenConfiguration(){
        MainMenu.clickMenu("Settings");
        SubMenu.clickSubMenu("Shared configuration");
        SharedConfigurationPage.openSharedConfiguration("Jenkins: Server");
        SharedConfigurationPropertiesPage.checkSharedConfigurationHeader("Jenkins");
    }

    @Test
    public void SaveConfiguration(){
        MainMenu.clickMenu("Settings");
        SubMenu.clickSubMenu("Shared configuration");
        SharedConfigurationPage.openSharedConfiguration("Git: Repository");
        SharedConfigurationPropertiesPage.checkSharedConfigurationHeader("Git");
        SharedConfigurationPropertiesPage.setEditFieldBySequence(1,"Git Title Name");
        SharedConfigurationPropertiesPage.setEditFieldBySequence(2,"Git Url");
        SharedConfigurationPropertiesPage.clickButtonByText("Save");
        SharedConfigurationPropertiesPage.isNewConfigurationSaved().isSharedConfigurationPageVisible("Git: Repository");
    }

    @Test
    public void TestFortifyRelease() {
        MainMenu.clickMenu("Settings");
        SubMenu.clickSubMenu("Shared configuration");
        SharedConfigurationPage.openSharedConfiguration("Fortify on Demand: Server");
        SharedConfigurationPropertiesPage.setEditFieldBySequence(1, "XL Fortify on Demand");
        SharedConfigurationPropertiesPage.setEditFieldBySequence(2, "https://api.emea.fortify.com/");
        GlobalFunctions.typeTextById("username", System.getProperty("fortify.user"));
        GlobalFunctions.typeTextById("password", System.getProperty("fortify.password"));
        SharedConfigurationPropertiesPage.clickButtonByText("Save");

        MainMenu.clickMenu("Design");
        SubMenu.clickSubMenu("Templates");
        TemplateListPage.clickNewTemplate();

        CreateTemplatePage
                .createTemplateByName("XLR Fortify on Demand Template")
                .addTask("Fortify on Demand Test", "Fortify On Demand", "Check Compliance")
                .selectItemByIndex(1, "XL Fortify on Demand")
                .typeStringByIndex(1, "xl-release")
                .typeStringByIndex(2, "master")
                .typeVariableByIndex(1, "1")
                .closeTaskDetails()
                .newReleaseFromTemplate()
                .createReleaseByName("XLR Fortify Release")
                .startRelease()
                .waitTillReleaseCompletes(15);
    }

    @Test
    public void TestCreateUserStory(){
        TaskDetailPage taskDetailsPage;
        MainMenu.clickMenu("Settings");
        SubMenu.clickSubMenu("Shared configuration");
        SharedConfigurationPage.openSharedConfiguration("Rally: Server");
        SharedConfigurationPropertiesPage.checkSharedConfigurationHeader("Rally");
        SharedConfigurationPropertiesPage.setEditFieldBySequence(1, "Rally Config 1");
        SharedConfigurationPropertiesPage.setEditFieldBySequence(2, "rally1.rallydev.com");
        SharedConfigurationPropertiesPage.clickElementById("authenticationMethod"); // clicking the element so that
        // select field will be visible on
        // next step
        SharedConfigurationPropertiesPage.setOptionFromSelectFieldBySequence(1, "Basic");
        SharedConfigurationPropertiesPage.typeElementById("username", "yeti@rallydev.com");
        SharedConfigurationPropertiesPage.typeElementById("password", "Vistabahn");
        SharedConfigurationPropertiesPage.clickButtonByText("Test");
        SharedConfigurationPropertiesPage.checkConnectionStatusShouldContain("Rally Server is available");
        SharedConfigurationPropertiesPage.clickButtonByText("Save");
        MainMenu.clickMenu("Design");
        SubMenu.clickSubMenu("Templates");
        TemplateListPage.clickNewTemplate();
        CreateTemplatePage.createTemplateByName("Rally Create User Story Template")
                .addTask("Rally", "Rally", "Create User Story")
                .selectItemByIndex(1, "Rally Config 1")
                .typeStringByIndex(4, "Alligators BLD Unigrations")
                .typeStringByIndex(5, "Manual Test 4")
                .addKeyValue("name", "testxlr").closeTaskDetails().newReleaseFromTemplate()
                .createReleaseByName("Rally Release").startRelease()
                .waitTillReleaseCompletes(25);
    }

    @AfterMethod
    public void logout(){
        MainMenu.logout();
    }
}

Prerequisite

  • XL Release server must be running
  • v0.0.5 is compatible with XLR 8.0.x NO LONGER SUPPORTED - 8.0.x javadocs
  • v0.0.6 + is compatible with XLR 8.1.x - 8.1.x javadocs
  • v0.0.7 + is compatible with XLR 8.2.x - 8.2.x javadocs
  • backend required to test your plugin end to end must be up and running

How to use

  • add maven plugin as testcompile dependency to your gradle project download
  • add this test task inside your build.gradle

      test {
          useTestNG() {
              //set TestNG output dir
              outputDirectory = file("$project.buildDir//testngOutput")
              //required to turn on TestNG reports
              useDefaultListeners = true
          }
      }
    

To Run the tests against your own server / browser preference

  • Set environment variable WEB_SERVER pointing to your XLR instance
    • default is http://localhost:5516
  • Set environment variable BROWSER to either chrome or firefox
    • default is chrome
  • To launch the chrome browser in headless mode set env variable CHROME_HEADLESS_MODE to true
  • To launch the firefox browser in headless mode set env variable FIREFOX_HEADLESS_MODE to true
  • Run ./gradlew test this will launch the tests against the server

view the test report - compatible with TRAVIS-CI and JENKINS

  • Once tests are completed you will see the test report inside build/testngOutput/emailable-report.html