Skip to content

Conversation

@BMaxV
Copy link
Contributor

@BMaxV BMaxV commented May 2, 2020

Hello, I noticed there is now a test coverage tool integrated in CI, and I probably can write test?

Not sure. I looked at the source in the test coverage tool and if I understood it correctly, the methods are defined but never executed in tests.

This very simple test should test if the constructor and that pretty print function can be executed?

@codecov
Copy link

codecov bot commented May 2, 2020

Codecov Report

Merging #932 into master will increase coverage by 0.70%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #932      +/-   ##
==========================================
+ Coverage   15.02%   15.72%   +0.70%     
==========================================
  Files        3701     3701              
  Lines      355688   355750      +62     
==========================================
+ Hits        53431    55954    +2523     
+ Misses     302257   299796    -2461     
Impacted Files Coverage Δ
panda/src/event/pythonTask.cxx 38.68% <0.00%> (-3.53%) ⬇️
panda/src/pgraph/cullFaceAttrib.cxx 17.34% <0.00%> (-1.03%) ⬇️
panda/src/egg/eggTransform.I 46.29% <0.00%> (-0.14%) ⬇️
direct/src/dcparser/dcPacker.I 11.98% <0.00%> (-0.03%) ⬇️
panda/src/gobj/shader.cxx 8.45% <0.00%> (-0.01%) ⬇️
panda/src/event/pythonTask.h 88.88% <0.00%> (ø)
panda/src/event/asyncTask.cxx 40.95% <0.00%> (ø)
direct/src/dcparser/dcClass.cxx 0.00% <0.00%> (ø)
direct/src/dcparser/dcSwitch.cxx 0.00% <0.00%> (ø)
panda/src/event/asyncTaskChain.h 44.00% <0.00%> (ø)
... and 128 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3000aa2...40f718a. Read the comment docs.

@BMaxV
Copy link
Contributor Author

BMaxV commented May 2, 2020

Ok so ignoring what the super detailed report says, the check says code coverage increased by 0.05% so that's something?

@rdb
Copy link
Member

rdb commented May 2, 2020

The line coverage testing (which still isn't quite working well) is meant to give a rough estimation of which parts of the Panda codebase are covered by tests, by checking which lines of code are being hit when running the test suite. It can not, however, say how well the behaviour of these lines are being tested. It doesn't know whether you've actually created asserts to verify the behaviour, or whether you just created a test suite that runs those methods and doesn't test their results.

Of course, testing that constructing an empty Actor doesn't crash Panda arguably tests something and is better than nothing, but the intent should never to be to just write the minimal test to make codecov think it's covered.

@BMaxV
Copy link
Contributor Author

BMaxV commented May 2, 2020

Yes. My idea was to clear some low hanging fruit with methods that don't do anything complex and/or should "just work", like the actor constructor, which provides good defaults for all cases.

At least in the python parts that I know, I expect a lot of getter and setter functions that really should work almost trivially and should be easy to test. And it should be obvious if it's a "good" test too.

@rdb
Copy link
Member

rdb commented May 4, 2020

OK, I'm quite happy to entertain these kinds of pull requests, though testing that an empty Actor constructor doesn't crash is the absolute minimum we can test about this. This would make codecov tick off the Actor constructor code as tested but without actually testing the most common ways to use the Actor constructor, nor that the Actor constructor actually did its job correctly.

If there were tests that used the various forms of the Actor constructor and did some testing on its behaviour, I would be happy to consider that.

@BMaxV
Copy link
Contributor Author

BMaxV commented May 8, 2020

Ok so I thought about this a bit.

I added two tests that perform the same action as is described in the tutorial, so there is that bit of functionality. But that does not address the question whether the function is actually performed, or the code just runs without errors.

I.e. it does not test if the rendering would work. But then I don't know how to test that or if you usually test that.

And it should also be difficult to test other things for basic stuff without also testing the init?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants