-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lots of functions need unitary tests #29
Comments
Another remark, I would write like this (to test though):
|
i think all these strings should be replaced by proper templates that are loaded from some kind of central location where they can be evaluated in a proper context. rather than being defined within the class... |
@rjodon here I could use your help...never wrote unitary tests... |
I don't have the time today, but on Monday, I will add a few test to the repo, just to show you how it works. @brgcode Any preferences for the tests? I am really not a fan of |
COMPAS uses |
OK, I will check how to use pytest in the compas repo, it's probably simpler for everybody if all our projects are following the same guidelines, uses the same tools etc... |
great, thanks |
@franaudo I just committed a few test cases for a single function in I am discovering In theory, the goal of unitary tests is to find out every cases that can happen with your function. In our case, you have a Also, in theory, unitary test are testing a single and isolated function in a clean environment for each test, it's why I copy each time the function and create a new one for each case. I do want to start from a clean state. It's also to avoid including bugs in my test. I am also often adding workflow tests. It helps when you need to refactor and want to keep a global behaviour. Note: Note: Most of unitary tests seems obvious and useless as you are testing really simple functions. When you refactor, they are life and time saving though. |
I think lots of functions are not so obvious to understand and could easily lead to bugs.
Writing unitary test for them within unittest framework would be a great idea for:
Example with this:
If you take a month of holiday and I am in charge of the maintenance without knowing Abaqus, your part of the code, a small test case for this function will give me all the cards in my hand for fixing a bug. I will know exactly what is inside each variable and what to expect from the function.
The text was updated successfully, but these errors were encountered: