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
Consolidate Test suite C++ code/create templates
directory
#4489
Comments
I think I am on board with creating a test object for each object type (Kernel, etc.), but we need to come up with a common scheme for triggering the different tests. In the few objects I have made I have a MooseEnum parameter, "test_type", that changes the behavior. I would want this to be consistent through all the objects, perhaps we need a simple TestObject base class to bring in this parameter consistently. 👍 on the templates directory, I think this is a great idea. It then would be super easy to even make a little helper script to rename the file and class names for building a new object, something I already do. For example:
|
I'm going to copy over my comments from the PR: |
As for the debate about testing objects... I actually prefer to have a bunch of small testing objects that test individual features. That way when something fails it's easy to track down. This is actually what MooseTest is for... I don't consider it bloat because it doesn't get compiled unless you specifically go do it. So far we've done a really good job of using objects from MOOSE itself to do the testing with... but sometimes there is no way around it (I recently had to add an object to test solution vector serialization - nothing in MOOSE was using it). Also: I would MUCH rather add to MooseTest than add to MOOSE itself... Finally: If you think of these testing objects like Unit tests then having one object per feature makes sense.... that's what we do in MooseUnit for instance... |
Specifically I don't want to see this:
Yuck! MOOSE is designed for lots of small objects... and that's the way we should do our testing as well. |
(from @aeslaughter ) However, I generally side with you. Lets see what @permcody says, he was the one that really doesn't like all the objects. |
Seriously... the more I think about this... the more it makes me sick to think of monolithic testing objects. Thousands of parameters... hundreds of class member variabes... spaghetti of if statements and case statements. Just straight up NO. That said - we should be judicious in creating new testing code... try to reuse what we already have when possible. BUT: Like I said, I think we've been really good about doing this up to now and I don't see any reason to make a policy change. |
(from @YaqiWang) Test codes can currently indicate what is going wrong for us, which is really nice. The size of test codes should not be a big issue due to the duplication in them IMO. Most of these duplication are really stable in MOOSE and will possibly not cause any painful refactoring. We do not need to make test codes fancy. ;-) |
@aeslaughter Right: I was just saying that if we start to make rules about what kinds of objects we can put in MooseTest people might prefer to put "testing code" over into MOOSE (there are lots of objects in MooseTest that aren't "testing" code... but also necessarily aren't useful enough to be in MOOSE either) Things like: And many more. Each of those "could" be in MOOSE (arguably it's possible that someone might find them useful)... but we were using them to exercise a bit of code. If we start restricting what goes in MooseTest then that might lead to a few more of these types of objects actually ending up in MOOSE itself... |
Ultimately I just don't think this is enough of a "problem" to warrant a heavy handed code / system solution... |
I'm not necessarily advocating going to one object for everything. I think the right thing to do will be something in the middle. Using your example of an ugly case statement and turning it around to have one object for everything, you get this:
Diff1Material, Diff2Material?!? What I'd like to see is just better design of our testing objects. Consolidation where it makes sense. For instance, we don't need another version of the Diffusion kernel with just one extra thing added to it to trigger an extra line of code. In the last case, Andrew created a whole new object just to test a method that returns a simple string. The compute method of that object was a duplicate of something we already had. Why not just add a method in InitialSetup to trigger the testing of that string? In the case of objects that trigger errors, why not have a case statement? I agree @friedmud, I don't want a giant case statement in a few monolithic objects, but I don't want several hundred small objects sitting around on my system for testing fewer lines of nonessential code that they themselves contain. Let's be smart about how we consolidate, and when. |
I definitely agree that some cleanup is needed. A lot of that stuff is left over from long ago... My favorite is definitely:
lol |
I'll take care of that Diff{1|2}Material stuff... On Thu, Jan 8, 2015 at 11:31 AM, Derek Gaston notifications@github.com
|
1) Diff{1|2}Material removed 2) Replaced with a better test that exercises different types of material properties. Refs idaholab#4489
The discussion for this started in PR #4469. Basically, @permcody pointed out that we are getting a lot of source code in test/src and test/include, some of which is performing very simple tasks or is just redundant. So this issue is mainly to come up with a design that consolidates some of the test code, if possible.
As a side issue, @jwpeterson noted that it is sometimes nice to be able to copy/paste code from the tests directory when starting something new, but it will be more awkward to do this if the testing source code gets consolidated. So it might be worth having a "templates" directory with a template Material, Kernel, etc. in there for people to copy paste from that would also be run as tests to ensure they were kept up-to-date.
The text was updated successfully, but these errors were encountered: