Search code examples
testingautomationprotractortestngappium

How can i generate a script that contain configuration of capabilities and all the setup for my tests to avoid writing a setup method in each class


In order to automate test cases with java using testNG and Appium :

  • How can i generate a script that contain common configuration of capabilities and all the setup for my tests to avoid writing a setup method in each class and run it with the same manner as when i run appium by npm with protractor scripts

This is the following code i use to run appium with protractor by console :

appium --default-capabilities '{"app":"safari","browserName":"safari","appium-version":"1.5.1","platformName":"iOS","platformVersion":"9.3","deviceName":"iPad Air","nativeInstrumentsLib":true}' --command-timeout "0" --pre-launch --nodeconfig "/Users/me/nodeconfig.json" --launch-timeout "180000"
  • Another question : How can i use only console with testng test and eliminate the use of eclipse IDE as i'm doing with protractor all my test written with console in vi mode in Mac ?

Solution

  • For java using testNG and Appium:

    create a base class where you will set the appium driver with all the capabilities and than extend this base class to get the appium driver.

    u can also do this by invoking that class constructor. U can go through this sites to get idea:

    http://toolsqa.com/selenium-webdriver/constant-variables/

    http://blog.xebia.in/2016/01/11/Design-Patterns-in-Selenium-Automation-Part1-POM/