cucumber with appium

12
How to integrate Cucumber with Appium!! Raman Hullur Email: [email protected] Twitter: raman_hullur Linked In: Raman Gowda Hullur

Upload: raman-gowda-hullur

Post on 11-Apr-2017

106 views

Category:

Software


0 download

TRANSCRIPT

How to integrate Cucumber with Appium!!

Raman HullurEmail: [email protected]: raman_hullurLinked In: Raman Gowda Hullur

Pre Requisites:

• Java • Eclipse• Android SDK• Appium with Respective Maven dependencies/.jars• Basic Knowledge on Cucumber .feature file

For writing with Gherkins annotation for Test Scenario and Requirements representation.(No worries sample is available with this presentation ).

if maven project:MVN Dependencies: https://mvnrepository.com/artifact/info.cukes/cucumber-java https://mvnrepository.com/artifact/info.cukes/cucumber-junithttps://mvnrepository.com/artifact/info.cukes/cucumber-core

if Non-Maven Project:Library File/.jars:cucumber-java 1.1.1.jarcucumber-junit 1.1.1.jarcucumber-core 1.1.1.jar

1. Launch Eclipse with a workspace or new workspace

2. Provide a Group ID and Artifact ID for as highlighted in the screenshot then click Finish

3. Open the Project Explorer to see the Project Hierarchy then Double click and Open the POM.xml file

4. Copy the necessary dependencies under new <dependency> attribute as in the screenshot as highlighted in POM.xml SS and Save it(wait until project get build again)

5. Create Test Scenario File with .feature ext file under Project Package level6. In Order, As a and I Want are the Requirement Keywords and rest of the sentence is test scenario7. Given, When and Then are the Gherkins language Keywords for more info:https://cucumber.io/docs

Type below the template into your .feature file

8. Create a Driver class with @Runwith and @Cucumber.Options annotations on above the class name! See below the SS.

9. Create Another class to access the .feature test scenario statements that mentioned under the .feature fileNote : Scenario statement must be within "^ --scenario----&" along with @Given/@When/@Then

a.@Given("^I enter the search item ([^\"]*)$")

10. Here "([^\"]*)" is regular expression to accept dynamic input or test data

@When("^I logged in as a user$") and @Then("^I get the Valid result ([^\"]*)$")

One more negative test scenario is left from .feature file and no need to write again methods only @Then is enough and rest be reusable from previous @Given and @When!!

11. Feature file last negative test scenario need another method with @Then annotation as highlighted below,

@Then("^I get the Invalid result ([^\"]*)$")

Note: @Then scenario statement in .feature file as different statements/result hence, we need different method!

For Further References:https://cucumber.io/docs#referencehttps://cucumber.io/docs/reference/jvm#java

- Thank You!! Happy Learning!!