配置robotframework框架的自动化环境

Install JDK 1.8

Set maven

Follow instructions in https://maven.apache.org/install.html

  • Download maven and install it to file /usr/local/
  • Set environment variable:
  1. Go to terminal and go to java home: echo $JAVA_HOME
  2. ls -la
  3. Edit file: .bash_prodile
  4. Add the following maven path to the file 
    #MAVEN
    
    export PATH=/usr/local/apache-maven-3.5.2/bin:$PATH
    Maven Path
  5. Run mvn –v to make sure the mvn been installed and configurated
  6. Copy file ‘settings.xml’ to Users/{username}/.m2/directory and update your user name and password with VPN account

Install Eclipse

  • Go to http://www.eclipse.org/downloads
  • Choose the appropriate version for your system (ie. Windows 64 bit), and download the eclipse-inst-win64.exe file.
  • Double-click the downloaded file to run the installer.

RobotFramework-EclipseIDE Plugin

  • To add plug in eclipse for syntax coloring preferences
  • Click on eclipse Help → Eclipse Market Place..
  • Search for RED and install for plugin

Clone code from stash and import in eclipse

  • Go to https://stash.tubemogul.info/projects/QE/repos/v-ui/browse  to copy clone dir: https://username@stash.tubemogul.info/scm/qe/v-ui.git
  • Open terminal to the workspace you want to put your code and run: git clone https://username@stash.tubemogul.info/scm/qe/v-ui.git
  • Go to eclipse to import Existing Maven Project and run maven clean install –U after project import
OR

Setup run configuration: 2 ways

  1. Import: Menu File-Import-Run/Debug-Launch configuration-Select folder: v-ui/config/launch_configurations and Import all configurations
  2. Manually setting: 
    • Open Run Configurations
    • Add new launch configuration for Java Application
    • Provide the project and main class as org.robotframework.RobotFramewor
    • Provide run {testcase_filepath} in Arguments and click Run (generic path: run ${selected_resource_loc})
    • To run with firefox existing profile, provide the profile name in VM arguments.
    • Example: -Dwebdriver.firefox.profile=default
    • To run in Google Chrome, use this VM arguments
      -Dwebdriver.chrome.driver=${workspace_loc:/v-ui}/drivers/chromedriver
原文地址:https://www.cnblogs.com/peiling-wu/p/8662252.html