Skip to content

salman-/Mobile-Automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cara Android Mobile-Automation

This project automate the Cara Android Application.


Pre-requsit to run the test

  1. Install Lombok 1.18.2
  2. Install Cucumber Eclipse plugin on your Eclipse or the alternative for Intellij
  3. Install Cara Android Application
  4. Run Appium server using Appium Desktop or by Appium command
  5. Run adb devices over the command line and get the uuid, then write the uuid

How to Run

There are two different ways to run the test:

  1. From src/test/resources open the *.feature. Right click on it, Run as > Cucumber feature This approach does not generate any report

  2. From src/test/java/runner open the TestRunnerJUnit class. Right click on it, Run as > JUnit test This approach generates an HTML report in the target folder.

  3. mvn test


Technologies

Technology Stack
Build Tool Maven
Language Java 1.8
UI technology Selenium / Cucumber / Appium
Test framework Junit
Reporting cucumber-extentsreport 3.1.1
Manage boilerplate code Lombok 1.18.2
IDE STS 3.9.6.RELEASE

How code works

Inorder to connect Hook to steps, we need to use the cucumber-picocontainer as dependency:

<dependency>
      <groupId>info.cukes</groupId>
      <artifactId>cucumber-picocontainer</artifactId>
      <version>1.2.5</version>
 </dependency>

And then implementation of dependency injection in cucumber and selenium is as below:

The step class:

public class *Steps extends Driver{

	Driver driver;


	public *Steps(Driver driver) {

		this.driver = driver;
	}

	public *Steps() {}

The Hook class


public class Hooks extends Driver {

    Driver driver;

    public Hooks(Driver driver) {
        this.driver = driver;
    }

    public Hooks() {}

    @Before
    public void testInitializer() throws MalformedURLException {

        DesiredCapabilities cap = new DesiredCapabilities();
        cap.setCapability("deviceName", "Your-Device-Name");
        cap.setCapability("udid","UUID of Your Device");
        cap.setCapability("platformName","Android");
        cap.setCapability("platformVersion","Your Android Version");

        cap.setCapability("appPackage","com.gohidoc.cara");
        cap.setCapability("appActivity","com.gohidoc.cara.MainActivity");

        AppiumDriver<MobileElement> dr = new AppiumDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"),cap);

        driver.setDriver(dr);

    }


    @After
    public void tearDownTest(Scenario scenario){

        driver.closeTheApp();
    }

}

And finally the Driver class:

public class Driver  {

	//WebDriver driver;
	 AppiumDriver<MobileElement> driver;
}

Here is the class diagram of the Driver, Step and Hooks

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors