All Downloads are FREE. Search and download functionalities are using the official Maven repository.

automated.test_manage.run.WebTestCaseRunner Maven / Gradle / Ivy

package automated.test_manage.run;

import automated.assertions.TestAssertion;
import automated.platforms.web.WebActions;
import automated.test_manage.config.Platform;

/**
 * Created by Ismail on 12/28/2017.
 * This class for Custom Web Actions Section
 * and to inherit all generic actions from TestCaseRunner
 */
public class WebTestCaseRunner extends TestCaseRunner {

    /*************** Class Methods Section ***************/
    // This constructor return platform
    // default variable value as Web
    public WebTestCaseRunner() {
        Platform.platform = "web";
    }

    /***************** Actions Implementation Section *****************/
    // This method Apply visitUrl action
    // that implemented in WebActions
    protected void visitURL(String urlString) {
        // Call navigateTo Method from WebActions
        // class to execute visitUrl action
        WebActions.navigateTo(urlString);
    }

    // This method Apply visitUrl action
    // that implemented in WebActions
    // This method get URL from Method Data File
    protected void visitURL() {
        // Define urlString and retrieve it's data from data file
        String urlString = TestCaseFiles.getValueOfDataRow();
        // Call navigateTo Method from WebActions
        // class to execute visitUrl action
        WebActions.navigateTo(urlString);
    }

    /***************** Assertion Actions Section *****************/
    // This method to apply Verify current title assertion
    protected void verifyCurrentTitle(String expectedTitle, String errMessage) {
        TestAssertion.assertCurrentTitle(expectedTitle, errMessage);
    }

    // This method to apply Verify current URL assertion
    protected void verifyCurrentURL(String expectedURL, String errMessage) {
        TestAssertion.verifyCurrentURL(expectedURL, errMessage);
    }

    // This method to apply Verify Text assertion
    protected void verifyTextEquals(String actualText,
                                    String expectedText, String errMessage) {
        TestAssertion.assertStringEquals(actualText, expectedText, errMessage);
    }

    // This method to apply Verify Text assertion
    // but the Expected Value from dataFile
    protected void verifyTextEquals(String actualText, String errMessage) {
        // Get Expected Text from Data File
        String expectedText = TestCaseFiles.getValueOfDataRow();
        verifyTextEquals(actualText, expectedText, errMessage);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy