Patrick Winkler Posted October 20, 2016 Share Posted October 20, 2016 Hello, how can I check if the script is executed in the VW environment. thanks Quote Link to comment
JBenghiat Posted October 20, 2016 Share Posted October 20, 2016 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 Quote Link to comment
Patrick Winkler Posted October 26, 2016 Author Share Posted October 26, 2016 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 Quote Link to comment
JBenghiat Posted October 27, 2016 Share Posted October 27, 2016 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 Quote Link to comment
Dieter @ DWorks Posted November 2, 2016 Share Posted November 2, 2016 (edited) 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 November 2, 2016 by Dieter @ DWorks 1 Quote Link to comment
Recommended Posts
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.