Skip to content

Instantly share code, notes, and snippets.

View shankybnl's full-sized avatar
👋

Shanky Sharma shankybnl

👋
View GitHub Profile
@shankybnl
shankybnl / BreachEngineTags.feature
Created June 13, 2018 12:36
BreachEngineTags.feature
@allbreach
Feature: Breach engine tests to verify breach in case vehicle ETD change.
Background: Assign pilots on activity. Two home pilots (of DELP1 with pilot id:1422 and 1423)
reseted to a pitstop (DELP1). One Vehicle is going from DELP1 to AMBP1 (1121286)
and other to JAIP1(894440).ETD of both vehicles is in next 2 hours
(ETD from current time) at DELP1.
Given Active pilots "1422,1423"
And Reset pilot 1422 to "DELP1"
@shankybnl
shankybnl / BreachEngine.feature
Created June 6, 2018 18:36
BreachEngine.feature
@allbreach
Feature: Breach engine tests to verify breach in case vehicle ETD change.
Background: Assign pilots on activity. Two home pilots (of DELP1 with pilot id:1422 and 1423)
reseted to a pitstop (DELP1). One Vehicle is going from DELP1 to AMBP1 (1121286)
and other to JAIP1(894440).ETD of both vehicles is in next 2 hours
(ETD from current time) at DELP1.
Given Active pilots "1422,1423"
And Reset pilot 1422 to "DELP1"
@shankybnl
shankybnl / HibernateUtil.java
Created June 6, 2018 18:34
HibernateUtil.java
public class HibernateUtil {
private static final SessionFactory sessionFactory;
static {
try {
Configuration cfg = new Configuration();
cfg.setProperty("hibernate.connection.url", CommonUtil.loadTestData.getString("connection.url"));
cfg.setProperty("hibernate.connection.username", CommonUtil.loadTestData.getString("connection.username"));
cfg.setProperty("hibernate.connection.password", CommonUtil.loadTestData.getString("connection.password"));
cfg.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
@shankybnl
shankybnl / CucumberRunnerUtil.java
Last active June 13, 2018 11:54
CucumberRunnerUtil.java
@RunWith(Cucumber.class)
@CucumberOptions(
monochrome = true,
features = "src/test/java/features",
glue = {"utils","steps"},
tags = {"@single"},
format = {
"pretty",
"html:target/cucumber-reports/cucumber-pretty",
"json:target/cucumber-reports/CucumberTestReport.json",
@shankybnl
shankybnl / PilotSteps.java
Created June 6, 2018 18:18
PilotSteps.java
@Given("^Vehicle of pilot (\\d+) gets \"([^\"]*)\" by (\\d+) minutes")
public void vehicleOfPilotGetsByMinutes(long pilotId, String timeChange, int timeUpdateInMinutes) throws Throwable {
// Write code here that turns the phrase above into concrete actions
session = CrudOperations.createHibernateConnection();
List<PilotActivity> pilotActivity = session.createQuery("from PilotActivity where isActive=true order by id desc").setMaxResults(1).list();
DateTime currentExpectedStartTimeAtCreation = pilotActivity.get(0).getExpectedStartTimeAtCreation();
@shankybnl
shankybnl / RestUtil.java
Last active June 6, 2018 18:16
RestUtil.java
public class RestUtil {
Map<String, String> getRequestHeaders;
Map<String, String> getRequestParameters;
HashMap<String, String> postRequestHeaders;
HashMap<String, String> postRequestParameters;
RequestSpecification baseSpec;
public RestUtil() throws Exception {
this.getRequestHeaders = new HashMap();
this.getRequestParameters = new HashMap();
@shankybnl
shankybnl / BDDExample.feature
Created June 6, 2018 18:11
Behavior-driven development (BDD) example
Scenario: Expected report time should be 15 mins before activity start time if vehicle is not placement dry run.
Vehicle HR55V1072 is going from DELP1 to JAIP1 and not placement dry run.
Given 120 minutes "added" to vehicle node tracking id 894440
And Pilot 1435 is on DUTY OUT
And Pilot 1448 is on DUTY OUT
And Pilot 1422 is on DUTY OUT
When AA scheduler executes
Then Pilot 1422 activity on vehicle number "HR55V1072" should "be active"
And Difference between expected report time of Pilot 1422 and activity start time of vehicle "HR55V1072" should be 15 minutes
@shankybnl
shankybnl / TDDExample.java
Created June 6, 2018 18:07
Test-driven development (TDD) example
@Test
public void verifyTimeDifferenceBetweenExpectedReportTimeAndActivityStartForNonPlacementVehicles() throws Throwable {
// increasing vehicle start time from current time by 2 hours
vehicleSteps.minutesShouldBeAddedOrDeletedToVehicleNodeTrackingId
(120, "added", 894440);
// end the duty for pilot 1435
pilotSteps.pilotIsOnDUTYOUT(1435L);
@shankybnl
shankybnl / PilotSteps.java
Created June 6, 2018 13:10
PilotSteps.java
@And("^Get all active \"([^\"]*)\" of pilots$")
public void getAllActiveOfPilots(String activityOrDuty) throws Throwable {
session = CrudOperations.createHibernateConnection();
if (activityOrDuty.equalsIgnoreCase("duties")) {
activePilotDutiesMap = new HashMap<>();
List<PilotDuty> pilotDuty = session.createQuery("from PilotDuty where isActive=true order by id desc").list();
@shankybnl
shankybnl / 1.png
Last active July 3, 2017 07:50
images
1.png