Spirent iTest - How to create PyDev project and how to develop and run python scripts


Doc ID    SOL14438
Version:    1.0
Status:    Published
Published date:    10/13/2020
 

Objective/Summary

Create a PyDev project and develop/run python scripts

Environment/Versions

Spirent iTest

Procedure

Below are the steps you need to follow to create a PyDev project, to develop and run python scripts properly.
To create a PyDev project you will need to:
  1. Go to /File/New/Other/PyDev/
  2. Select "PyDev Project" and then click Next
  3. At "Interpreter" dropdown list, select a Python Interpreter and then click on Finish
  4. Click on Open perspectives
To develop and run python scripts:
  1. Right click on created PyDev project and then select New/Other
  2. Select PyDev Module and then click Next
  3. Fill all required information and then click Finish
  4. Right-click on a created PyDev Module and click on "Run As"
  5. Click on "Python Run" button
If you want to open a .py file with iTest you will see that the file is opened under PyDev plugin.

Also if you already have a .py file and want to run it from python syntax test case, you need to import it in first eval and use on any other.
You can use below script to import a file:
               import sys
               sys.path.append(‘my_folder_with_script’)
               import my_module


In above picture simple is .py file name and my_function is the name of the function that I used in simple.py

Find Answers

Specified Languages
English
中文

Please Sign In

Username
Password

Did you forget your password?
Click here for assistance

New user? Start here.