Skip to content

Updated :#22

Open
harshit-google wants to merge 3 commits intosawantpritam:developfrom
harshit-google:cdf-slt
Open

Updated :#22
harshit-google wants to merge 3 commits intosawantpritam:developfrom
harshit-google:cdf-slt

Conversation

@harshit-google
Copy link

@sawantpritam @poojantcs

Sap slt plugins e2e selenium integration test.
This PR includes

  • Design time test scenarios
  • Negative test scenarios
  • Runtime Integration test scenarios

SLTActions.java
SLTLocators.java
StepDefinitionSLT.java
@@ -0,0 +1,59 @@
/*
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this file. Use PluginPropertyUtils.java from e2e frameweork

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File removed

invalidClient=CDF_SAP_01404 - SAP connection test failed. Please verify the connection parameters. Root Cause: JCO_ERROR_CONFIGURATION - Parameter SAP client ('jco.client.client') needs to be a three digit number string instead of 'abc'
invalidLang=CDF_SAP_01404 - SAP connection test failed. Please verify the connection parameters. Root Cause: JCO_ERROR_CONFIGURATION - Parameter logon language ('jco.client.lang') code 'invalid' is invalid
invalidCred=CDF_SAP_01404 - SAP connection test failed. Please verify the connection parameters. Root Cause: JCO_ERROR_LOGON_FAILURE - Name or password is incorrect (repeat logon)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove extra empty line

bqProjectId=cdf-athena
dataset=sap_automation
IM_GCP_KEY_NAME=CDFSLT

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove extra empty lines

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in last commit.

@@ -0,0 +1,19 @@
/*
* Copyright © 2021 Cask Data, Inc.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change year to 2022

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check in all licences.

public static SLTLocators sltLocators = new SLTLocators();
public static String rawLog = null;
private static WebDriver CDFDriver;
BigQueryClient bqClient = new BigQueryClient();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this Instantiation.

elementHelper.sendKeys(sltLocators.jcoclientuser, CDAPUtils.getPluginProp(jcoclientuser));
elementHelper.sendKeys(sltLocators.jcoclientpasswd, CDAPUtils.getPluginProp(jcoclientpasswd));
}
public void sltplugin_click() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use generic plugin click action from CdfStudioActions

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method updated.

elementHelper.clickOnElement(sltLocators.sltplugin);
}

public String rowError_color() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rowError_color -> getRowErrorBorderColor

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getRowErrorBorderColor used.

return elementHelper.getElementCssProperty(SLTLocators.rowError, "border-color");
}

public void next_click() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clickNextButton

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated as per method action.

elementHelper.clickOnElement(sltLocators.table(tableName));
}

public void datasetName_fill (String stagingBucket) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enterDatasetName

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated as per method action.

elementHelper.clickOnElement(sltLocators.deployPipeline);
}

public void startPipeline() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clickStartPipelineButton

Check all method names. Should start with action(i.e click , enter , select, get etc)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated as per method action.

@sawantpritam
Copy link
Owner

Please add proper PR title.

@sawantpritam
Copy link
Owner

Indent looks incorrect. Please reformat all files in the PR using this settings file - https://cdap.atlassian.net/wiki/spaces/CE/pages/1594098619/Coding+Standard


static {
CDFDriver = SeleniumDriver.getDriver();
sltLocators = SeleniumHelper.getPropertiesLocators(SLTLocators.class);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assignment to sltLocators is not required. You can use directly with classname
i.e. likeSLTLocators.name SLTLocators.gcsDataPath


import java.io.FileInputStream;
import java.io.IOException;
import java.util.*;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid use of * in imports

private static String guid = null;
static boolean errorExist = false;
static String color;
private static AssertionHelper assertionHelper = new AssertionHelper();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove instantiation. Use directly with className (AssertionHelper, ElementHelper, WaitHelper)

sapRecordsCount = 0;
}

@When("^Source is SAP SLT fill connection parameters$")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate steps
1.Select source plugin
2.Configure plugin with required properties

sltActions.next_click();
}

@Then("^Select Table \"([^\"]*)\"$")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are u using regular expressions.
You can simplify it like - > @then("Select Table {string}")

Applies to all

Then Click on next
Then Click on next
Then Click on Deploy Replication Pipeline
Then Update mass transfer id table: "<table>" job mode to "stop_load"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add validation

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working in progress.

Feature: Design Time SLT Scenario

@SLT @Design-Time @Sanity
Scenario Outline: User is able to provides input to SLT parameters
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

->Verify user is able to provides input to SLT parameters

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment for all scenario descriptions

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working in progress.

When User crates new MTID on "Automation" SAP
When User updates mtid config in CDF_R_SLT_SETTINGS program
When Source is SAP SLT fill connection parameters
Then User is able to set SLT parameter <option> as <input> and getting row <errorMessage> for wrong input
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> Verify user is able...............

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working in progress.

@SLT @Run-Time @Sanity
Scenario: User is able to create MTID and update CDF_R_SLT_SETTINGS program
Given User crates new MTID on "Automation" SAP
When User updates mtid config in CDF_R_SLT_SETTINGS program
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add validation step

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working in progress.

Then Wait till SLT pipeline is in running state and no error occurs
Then Close logs and stop the pipeline
Then Get Count of no of records transferred from SLT to BigQuery in "<table>"
Then User is able to validate record count in BQ matches with count in SAP
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

->Validate record count in BQ matches with count in SAP

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working in progress.

Copy link
Author

@harshit-google harshit-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed the code all the comments except updates required in Feature file. Will push those changes tomorrow.

Feature: Design Time SLT Scenario

@SLT @Design-Time @Sanity
Scenario Outline: User is able to provides input to SLT parameters
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working in progress.

Scenario: User is able to set Replicate Existing Data as false
Given Open CDF replication and initiate pipeline creation
When Source is SAP SLT
Then Replicate Existing Data is set to false
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working in progress.

Then Click on next
Then Click on next
Then Click on Deploy Replication Pipeline
Then Update mass transfer id table: "<table>" job mode to "stop_load"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working in progress.

When User crates new MTID on "Automation" SAP
When User updates mtid config in CDF_R_SLT_SETTINGS program
When Source is SAP SLT fill connection parameters
Then User is able to set SLT parameter <option> as <input> and getting row <errorMessage> for wrong input
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working in progress.

@SLT @Run-Time @Sanity
Scenario: User is able to create MTID and update CDF_R_SLT_SETTINGS program
Given User crates new MTID on "Automation" SAP
When User updates mtid config in CDF_R_SLT_SETTINGS program
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working in progress.

CDFDriver = SeleniumDriver.getDriver();
}

@FindBy(how = How.XPATH, using = "//input[@data-cy=\"name\"]")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using ' for all the locators

@FindBy(how = How.XPATH, using = "//input[@data-cy=\"name\"]")
public static WebElement name;
@FindBy(how = How.XPATH, using = "//input[@data-cy=\"gcpProjectId\"]")
public static WebElement gcpProjectId;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty lines added.

@FindBy(how = How.XPATH, using = "//input[@data-cy=\"gcpProjectId\"]")
public static WebElement gcpProjectId;
@FindBy(how = How.XPATH, using = "//div[contains(text(),'SAP Landscape Transformation (SLT)')]")
public static WebElement sltplugin;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As Replicator UI is quite different than Batch source cant use any of the existing Methods available in e2e.

@FindBy(how = How.XPATH, using = "//input[@data-cy=\"sapJcoLibGcsPath\"]")
public static WebElement sapJcoLibGcsPath;
@FindBy(how = How.XPATH, using = "//input[@data-cy=\"jco.client.ashost\"]")
public static WebElement jcoclienthost;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

public static WebElement viewsummary;
@FindBy(how = How.XPATH, using = "//span[contains(text(),'Deploy Replication Job')]")
public static WebElement deployPipeline;
@FindBy(how = How.XPATH, using = "//*[contains(text(), 'Logs')]")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried to use data-cy tag as much possible for uniformity but for the tags I have used best possible option available.

Then Enter the BigQuery Properties for slt datasource
Then Click on next
Then Click on next
Then Click on next

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have three steps clicking on the Next button. I believe, they are clicking the Next button element on three different pages. It will make test more readable if the step can be enhanced to take the page name and print it in the logs.

Then Click on next button on "String"


public static By replicationStatus = By.xpath("//*[contains(text(),'replication status: Process: ')]");

public static WebElement table (String tableName) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the locator name: locateTable(String tableName).

Use the same naming convention for all the methods in PO class: locateXYZ()

}
}

@Then("{string} the {string} records with {string} in the sap table")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@then("CUD action {string} the count {string} records with mode {string} in the sap table")

}

@Then("{string} the {string} records with {string} in the sap table")
public void createTheRecordsInTheSLTDatasourceFromJCO(String process, String recordcount, String rfcName)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

->performCUDOperationInTheSLTDatasourceFromJCO

}

@Then("{string} the {string} records with {string} in the sap table")
public void createTheRecordsInTheSLTDatasourceFromJCO(String process, String recordcount, String rfcName)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recordcount -> recordsCount

@Given("^Open CDF replication and initiate pipeline creation")
public void open_cdf_replication() throws IOException, InterruptedException {
openCdf();
SeleniumDriver.getDriver().get("http://localhost:11011/cdap/ns/default/replication/create");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pass url as parameter from properties file

}


@Given("^Open CDF replication and initiate pipeline creation")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check and remove regex from all stepDefinitions

}

public static WebElement inputParameter(String inputParameter) {
return SeleniumDriver.getDriver().findElement(By.xpath("//*[@data-cy='" +
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xpath can be simplified -> //input[@data-cy='" + inputParameter + "']

sltActions.clickSltPlugin();
}

@Then("Verify that after setting SLT parameter {string} as {string} plugin is throws error {string}")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate steps:

  1. Enter SLT parameter {string} with value {string}
  2. Verify SLT parameter validation error message {string} is displayed

}

@Then("Validate Replicate Existing Data can be set to false")
public void replicate_existing_data() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

->validateReplicateExistingDataState

Check all step definition's method names. Should align with step description

sltActions.clickNextButton();
}

@Then("Validate Table is available and can be selected {string}")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No validation in this definition.

-> @then("Select table {string}")

}

@Then("Validate Table is available and can be selected {string}")
public void select_table_something(String table) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

select_table_something -> selectTable

}

@Then("^Enter the BigQuery Properties for slt datasource$")
public void enter_the_bigquery_properties_for_slt_datasource_something() throws IOException {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_something ?

sltActions.enterDatasetName(pluginPropertyUtils.pluginProp("dataset"));
}

@Then("Validate Replication Pipeline can be deployed")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@then("Deploy replication pipeline")

sltLocators.logs.click();
parent = SeleniumDriver.getDriver().getWindowHandle();
tabs = new ArrayList(SeleniumDriver.getDriver().getWindowHandles());
SeleniumDriver.getDriver().switchTo().window((String) tabs.get(tabs.indexOf(parent) + 1));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use PageHelper.switchToWindow

Assert.assertEquals(sapRecordsCount, bqRecordCount);
}

@Then("Verify that user is able to update table {string} to {string} on LTRC")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> Verify that user is able to update table {string} to mode {string} on LTRC

}

@Then("Verify that user is able to update table {string} to {string} on LTRC")
public void slt_job_for_mtid_something_table_something_in_something_mode
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add proper method name

Thread.sleep(10000); //sleep required to wait for async operation to be executed on SAP
}

@When("Fetche the record count of table : {string} from SAP")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

->Fetch

}

@When("Fetche the record count of table : {string} from SAP")
public void user_fetches_the_record_count_of_table_something_from_sap(String table)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proper method name

}

@When("Validate that MTID can be Updated using CDF_R_SLT_SETTINGS program")
public void user_updates_mtid_in_program()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check all step definition's method names. Should align with step description.
Applies to all

public static SLTActions sltActions = new SLTActions();
public static SLTLocators sltLocators = new SLTLocators();
public static String rawLog = null;
BigQueryClient bqClient = new BigQueryClient();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove instantiation

When Select SAP SLT as source
Then Validate SLT parameter "<option>" can be set as "<input>"
Examples:
| option | input |
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check all Examples table -> Update headers with Title Case

i.e option -> Option , input -> Input

# the License.
Feature: Design Time SLT Scenario

@SLT @Design-Time @Sanity
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SLT tag can be added on Feature instead of duplicating on each scenario.

Given Open CDF replication and initiate pipeline creation
When Fetche the record count of table : "<table>" from SAP
Then Delete GCS folder for mass transfer id table "<table>"
Then Drop target BigQuery table "<table>"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perform this as test prerequisite in @Before scenario

@sawantpritam
Copy link
Owner

Indent looks incorrect. Please reformat all files in the PR using this settings file - https://cdap.atlassian.net/wiki/spaces/CE/pages/1594098619/Coding+Standard

Indent still looks incorrect... check all files in PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants