Hi Squish Users!
Check out our latest Squish tip, and learn how to enhance your code completion when working with Python!
Squish tip of the week: How to enable Code Completion for Shared Scripts (python)
Did you know by simply enabling a few Eclipse PyDev settings, and including an import statement in your Test Case the code completion also displays any functions defined in your Test Suite Resource scripts?
Adjust Code Completion Settings
- With a Squish Test Suite open, select Edit (or Squish IDE) > Preferences
- Expand PyDev > Editor and then select Code Completion
- Check the three Request Completion on… options
- Click OK
Tell your Test Suite where to find the Test Suite Resource scripts
- Click Window > Show View… > Other
- Expand PyDev and select PyDev Package Explorer
- From the PyDev Package Explorer, right click the currently active Test Suite and select Properties
- Select PyDev – PYTHONPATH
- Click Add Source Folder
- Expand the Test Suite > Test Suite Name > shared, and select scripts (if you do not have any Test Suite Resource Scripts this folder may not exist)
- Click OK, and click OK again on the Properties window
Now you are ready to begin using the code completion in your Test Suite!
Given a Test Suite Resource script script_1.py, create a new or open an existing Test Case and add the following:
With a function within your script file in the example above in mind, begin typing the few few characters of the function name.
if 0: from script_1.py import *
The code completion is now enabled for general scripting, and Squish is also now aware of any custom functions you create and indicate using the syntax above.
Checkout our video library later this week for a video demonstration working with code completion.
Related Knowledgebase Article
Request your free 30 day Squish evaluation
Learn more about Squish
Other Squish Resources (videos, tech articles, user communities and more)