Archive for category Misc

Cucumber Java Selenium – Super Brief sum up

I am trying to sum up the whole thing using few Bullet points.

You need to create 3 files in Eclipse.

  1. Feature file
    1. CreateAccount.feature
    2. Login.Feature
    3. Feature: Login
      Description: This feature is to test the login functionalityScenario: Successful Login with Valid Credentials
      Given User is on Home Page
      When User enters Username and Password
      And Clicks Go button
      Then A message is displayed
  2. Step Definition File:
    public class TestingSteps {
     static WebDriver driver;
     static String URL;@Given("^User is on Home Page$")
    
     public void user_is_on_Home_Page() {
    
     System.setProperty("webdriver.gecko.driver", "H:\\somePath\\geckodriver.exe");
     WebDriver driver = new FirefoxDriver();
     URL = "http://www.somesite.com/";
     driver.get(URL);
    }
    
    @When("^User enters Username and Password$")
     public void user_enters_UserName_and_Password() {
     WebElement loginLink = driver.findElement(By.id("login"));
     loginLink.click();
    
    WebElement emailField = driver.findElement(By.xpath("//div[@id='email']//input"));
     emailField.sendKeys("test@test.com");
    
    WebElement passwordField = driver.findElement(By.xpath("//div[@id='password']//input"));
     passwordField.sendKeys("abcabc");
     }
     @When("^Clicks Go button$")
     public void clicks_Go_button() {
     WebElement goButton = driver.findElement(By.id("goButton"));
     goButton.click();
     }
     @Then("^A message is displayed$")
     public void a_message_is_displayed() throws Throwable {
     WebElement practicePage = driver.findElement(By.id("DrpDwn"));
     practicePage.click();
     System.out.println("Login Successful");
     }
     }
  3. JUnit Runner
    1. package tests;
      import org.junit.runner.RunWith;
      import cucumber.api.CucumberOptions;
      import cucumber.api.junit.Cucumber;
      
      @RunWith(Cucumber.class)
      @CucumberOptions(
      features="src/feature",
       glue={"stepdefinition"}
       )
      public class TestRun {
      }

      4. Right click on the TestRunner file and click on Run as Java Application.

Advertisement

Leave a comment

How to enable Alt + Tab in citrix remote desktop

It’s been a year since the last post. Time does fly, now I see. Here is quick tidbit that I am using now a days.

http://support.citrix.com/article/CTX118974

HKEY_LOCAL_MACHINE \SOFTWARE\Citrix\ICAClient\Engine\Lockdown Profiles\All Regions\Lockdown\Virtual Channels\Keyboard\

Value Name: TransparentKeyPassthrough

Type: REG_SZ

Value: FullScreenOnly, Remote, or Local

Remote applies the Windows hotkeys to the window in focus.

Local never applies the Windows hotkeys to the session.

I am using ‘Remote”. Life seems easy.

Edit: 04/14/2011 – Looks like the settings are different for windows 7 64 bit. I will post on that soon.

,

26 Comments

%d bloggers like this: