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

Unit tests needed #162

Open
danmigdev opened this issue Jul 9, 2022 · 8 comments
Open

Unit tests needed #162

danmigdev opened this issue Jul 9, 2022 · 8 comments

Comments

@danmigdev
Copy link
Contributor

danmigdev commented Jul 9, 2022

We should add unit tests for existing codebase in order to have a coverage of 80% at least.

Each test class should test the related src class and be located under same package.
E.g. Tile.java src class is under project_16x16.components package (src/project_16x16/components directory). TileTest.java test class must be under project_16x16.components package (test/project_16x16/components directory).

Test class name must have the suffix Test added to the source class under test.
E.g. Tile.java src class to be tested must have a TileTest.java test class.

@vlad-nitu
Copy link

Unit tested Tile.java class and created PR for it (see #164)

@danmigdev
Copy link
Contributor Author

danmigdev commented Jul 10, 2022

Thanks for contribution! Hope it will be accepted. In order to improve code quality, I'd remove test word from method name (it is redundant) and use a self explaining format like [Calling]<METHOD>_[With<PARAMETERS or CONDITION>_]<EXPECTED_RESULT>

void getIDTest() -> CallingGetId_returnsId

Look here for some examples https://medium.com/@stefanovskyi/unit-test-naming-conventions-dd9208eadbea

@vlad-nitu
Copy link

vlad-nitu commented Jul 10, 2022

@redcloud80 thanks for the additional reading material, I'll have your note in mind when naming other test methods in the future (as I find getters test names to be self-explanatory).

@danmigdev
Copy link
Contributor Author

danmigdev commented Jul 12, 2022

Classes that need to be covered with a first unit test iteration:

PLEASE RESERVE A TASK IN ORDER TO AVOID CODING TASK OVERLAPPING BETWEEN DEVELOPERS.

  • Audio.java [DONE by @danmigdev]
  • Camera.java [WIP by @danmigdev]
  • Constants.java
  • Options.java
  • PClass.java
  • SideScroller.java
  • Tileset.java
  • Utility.java
  • components/AnimationComponent.java
  • components/Tile.java [PR waiting by @vlad-nitu]
  • entities/CleanerRobot.java
  • entities/Enemy.java
  • entities/Player.java
  • multiplayer/Multiplayer.java [DONE by @danmigdev]
  • objects/BackgroundObject.java
  • objects/CollidableObject.java
  • objects/EditableObject.java
  • objects/EditorItem.java
  • objects/GameObject.java
  • objects/MagicSourceObject.java
  • objects/MirrorBoxObject.java
  • particleSystem/Particle.java
  • particleSystem/ParticlePreloadSystem.java
  • particleSystem/ParticleSystem.java
  • particleSystem/Particles.java
  • particleSystem/emissions/ArchEmission.java
  • particleSystem/emissions/AreaEmission.java
  • particleSystem/emissions/DirectionalEmission.java
  • particleSystem/emissions/ParticleEmission.java
  • particleSystem/emissions/RectEmission.java
  • particleSystem/emissions/RotationEmission.java
  • particleSystem/events/ParticalVelocityController.java
  • particleSystem/events/ParticleAccelerationController.java
  • particleSystem/events/ParticleAnimationController.java
  • particleSystem/events/ParticleChildController.java
  • particleSystem/events/ParticleEventListener.java
  • particleSystem/events/ParticleNoLoopController.java
  • particleSystem/events/ParticleSizeController.java
  • projectiles/MagicProjectile.java
  • projectiles/ProjectileObject.java
  • projectiles/Swing.java
  • scene/AudioSettings.java
  • scene/GameplayScene.java
  • scene/MainMenu.java
  • scene/MultiplayerClientMenu.java
  • scene/MultiplayerHostMenu.java
  • scene/MultiplayerMenu.java
  • scene/PScene.java
  • scene/PauseMenu.java
  • scene/Settings.java
  • scene/gameplaymodes/GameplayMode.java
  • scene/gameplaymodes/ImportGameMode.java
  • scene/gameplaymodes/InventoryGameMode.java
  • scene/gameplaymodes/LoadExampleGameMode.java
  • scene/gameplaymodes/ModifyGameMode.java
  • scene/gameplaymodes/MoveGameMode.java
  • scene/gameplaymodes/PlayGameMode.java
  • scene/gameplaymodes/SaveGameMode.java
  • scene/gameplaymodes/TestGameMode.java
  • ui/Anchor.java
  • ui/Button.java
  • ui/List.java
  • ui/Notifications.java
  • ui/NumberInputField.java
  • ui/ScrollBarHorizontal.java
  • ui/ScrollBarVertical.java
  • ui/Slider.java
  • ui/Tab.java
  • ui/TextInputField.java
  • windows/ImportLevelWindow.java
  • windows/LoadLevelWindow.java
  • windows/SaveLevelWindow.java

@micycle1
Copy link
Collaborator

At this stage your time would better spent developing the game, rather than adding tests.

@danmigdev
Copy link
Contributor Author

I will for sure but testing is something that shouldn't be separated from feature implementation. I wouldn't release new features with no tests.

@calfaand
Copy link

calfaand commented Nov 3, 2022

Hello, can I contribute to this project with writing tests ?

@danmigdev
Copy link
Contributor Author

Hello, can I contribute to this project with writing tests ?

Hi, which class would you like to take care of? Open a specific issue for the task please.

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

No branches or pull requests

4 participants