Skip to content
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

Add Unit Tests #6

Closed
virtuoushub opened this issue Nov 3, 2014 · 4 comments
Closed

Add Unit Tests #6

virtuoushub opened this issue Nov 3, 2014 · 4 comments
Assignees
Milestone

Comments

@virtuoushub
Copy link
Collaborator

Write Unit tests with as close to 100% code coverage as possible. roughly 60%-70% code coverage and follow the 80/20 rule.

@virtuoushub virtuoushub self-assigned this Nov 3, 2014
@virtuoushub virtuoushub added this to the Code Health++ milestone Nov 3, 2014
@virtuoushub
Copy link
Collaborator Author

[updated to include more test runs]
I posit the difference in test runs has to do with the different IDEs used(Eclipse for the one minute, IntelliJ for the five minute), that and/or the way I am using Guice for DI. After further investigation, I was not creating a singleton via DI, and thus com.jed.core.MotherBrain.start() was getting called multiple times...

com.jed.* packages most used from a one minute on 2014-11-07 test using Mission Control

Stack Trace Sample Count Percentage(%)
com.jed.state.GameMap.update() 13 27.66
com.jed.core.QuadTree.clear() 3 6.383
com.jed.core.MotherBrain.start() 3 6.383
com.jed.core.QuadTree.getObjects() 2 4.255
com.jed.core.Collision$MinMax.(Collision, Boundary, Vector) 1 2.128
com.jed.actor.Boundary.getWorldPosition() 1 2.128
com.jed.actor.Player$Walking.update() 1 2.128
com.jed.core.Collision.compareTo(Object) 1 2.128
com.jed.core.QuadTree.insert(Entity) 1 2.128
com.jed.core.Collision.detectCollision() 1 2.128

com.jed.* packages most used from a five minute on 2014-11-08 test using Mission Control.

Stack Trace Sample Count Percentage(%)
com.jed.core.Collision.detectCollision() 8 5.298
com.jed.core.MotherBrain.start() 7 4.636
com.jed.core.QuadTree.insert(Entity) 6 3.974
com.jed.core.QuadTree.clear() 6 3.974
com.jed.core.QuadTree.(Vector, int, Rectangle, Displayable) 4 2.649
com.jed.state.GameMap.detectCollisions() 3 1.987
com.jed.core.QuadTree.getObjects() 2 1.325
com.jed.state.GameMap.update() 1 0.662
com.jed.actor.Boundary.getWorldPosition() 1 0.662
com.jed.state.GameMap.scrollMap() 1 0.662
com.jed.state.MapTile.draw() 1 0.662
com.jed.core.QuadTree.retrieve(List, Entity) 1 0.662
com.jed.actor.Player.draw() 1 0.662
com.jed.state.GameStateManager.draw() 1 0.662

com.jed.* packages most used from a one minute test on 2014-11-09 test using Mission Control.

Stack Trace Sample Count Percentage(%)
com.jed.state.GameMap.update() 20 42.553
com.jed.core.QuadTree.clear() 4 8.511
com.jed.core.QuadTree.insert(Entity) 4 8.511
com.jed.state.GameMap.drawMap() 3 6.383
com.jed.core.Collision.detectCollision() 2 4.255
com.jed.state.PlayState.getInput() 1 2.128

virtuoushub pushed a commit to virtuoushub/fuzzy-octo-shame that referenced this issue Nov 10, 2014
Noticed some issues with the test data from profiling I had done for FOShameDotOrg#6. I found I was not making the class a singleton.
@virtuoushub
Copy link
Collaborator Author

I totally have not written any unit tests, I updated the due date of this issues milestone to reflect this fact.

@virtuoushub
Copy link
Collaborator Author

Five Minute Test Run using 0.1.8-SNAPSHOT

Stack Trace Sample Count Percentage(%)
com.jed.state.GameMap.update() 46 13.939
com.jed.core.QuadTree.insert(AbstractEntity) 26 7.879
com.jed.core.Collision.detectCollision() 9 2.727
com.jed.state.GameMap.detectCollisions() 5 1.515
com.jed.core.QuadTree.(Vector, int, Rectangle, Displayable) 4 1.212
com.jed.core.MotherBrain.start() 4 1.212
com.jed.state.GameMap.drawMap() 3 0.909
com.jed.core.QuadTree.getObjects() 2 0.606
com.jed.state.GameStateManager.update() 2 0.606
com.jed.core.Collision.resolveCollision() 1 0.303
com.jed.actor.Player.update() 1 0.303
com.jed.core.QuadTree.retrieve(List, AbstractEntity) 1 0.303

@virtuoushub
Copy link
Collaborator Author

I still have not written any unit tests, I updated the due date of this issues milestone to reflect this fact.

virtuoushub pushed a commit to virtuoushub/fuzzy-octo-shame that referenced this issue Dec 7, 2014
virtuoushub pushed a commit to virtuoushub/fuzzy-octo-shame that referenced this issue Dec 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant