Jump to content
Patrick Winkler

Is Script executed in VW

Recommended Posts

Can you be more specific?  VS includes Message, AlrtDialog, and SysBeep to provide simple user feedback, but you can often just see if the script creates or modifies objects as expected. 

 

-Josh 

Share this post


Link to post

I want to create unit tests for my library.

If the test functions are executed in eclipse there should appear a warning because the vs functions are returning  only dummy values (vs.py)

in this case.

 

I could just check if a function returns a known dummy value to know if it's executed in VW but thats not so nice.

 

thanks

Share this post


Link to post

I may be misunderstanding your question, but as you surmised, the VS library is not available outside of VW for execution.  If you are doing unit testing, you have to do it inside VW.  Fortunately, because Python compiles at run time, you don't have to re-build and re-start every time you make a coding change.  You do have to go through a couple hoops to prevent included modules from caching, but you can start by searching for discussions on this in the archive (they may actually be in the VectorScript section from when before the discussion threads split in two).

 

In terms of seeing the result of your testing, you have a few options.  You can always use a alert dialog, which is useful for quick tests, but is certainly not practical for a lot of output.  

You can write your results to a log file.  Python's built in file access and logging are far superior to VS calls, so use those.

If you call print() in your script, the results will appear in the error output window that will open after your script completes.  You will also see this window if your script experiences any runtime errors.

 

HTH,
Josh

Share this post


Link to post

You can test without VW if you mock the vs module. It's easy and straightforward to do. Though how easy it is depends on what exactly you are testing....

As for testing your script from within VW, take a look at DLibrary, which did this.

Edited by Dieter @ DWorks
  • Like 1

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...