How to use robot framework with python in eclipse

2020-08-09 07:48发布

问题:

I have installed robot framework plugin into my eclipse. I have added python plugins and interpreter in the path, python files are executing successfully. I have added built-in library index file in the project, created robot text file and i want to execute the test but i right click on the test and try to run as, it is not giving the run configurations. I tried F9 for execution but it is not working. I think there is the separate set up required for running the robot tests in eclipse. my project we don't have access to Maven and client doesn't want Maven. Please let me know how to execute the robot tests in eclipse.

Thanks

回答1:

You can use RED (Robotframework Editor), an extension for Eclipse available in the Eclipse Marketplace. Once you installed, simply go to "Run -> Run configurations..." and configure a run profile under "Robot". Eclipse will execute the following command on your test:

/usr/bin/python -m robot.run

You can check the logs in the "Message Log" view, and test results in the "Execution View".



回答2:

Here's how I setup my Eclispe to run Pybot for Windows 7. You have to setup "External Tools", I don't have a high enough reputation to post images so see the steps below. Once you've setup an external tools configuration you'll use "Run-->External Tools-->Pybot".

HTH,

From the Eclipse tool bar:

  1. Run-->External Tools-->External Tools Configurations...
  2. From the "External Tools configurations" pop-up select "Program", then press the New button
  3. Fill in the following setting on the definition screen:
    • Name: Pybot (or a name of your choosing)
    • Location: C:\Python27\Scripts\pybot.bat (path to your pybot.bat file)
    • Working Directory: C:\workspace_42 (your Eclipse workspace)
    • Arguments: "${selected_resource_loc}"


回答3:

If you want to execute Python's flavour of Robot Framework you must use either command line or the Robot IDE (RIDE). To run your tests from the command line you must:
1. Open the terminal
2. Navigate to the appropriate directory
3. Use the pybot command and then specify the folder/file containing your tests

eg.

pybot mytestfolder
pybot myfirsttest.txt