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

Setup unit tests routine #71

Open
alkurbatov opened this issue May 11, 2020 · 4 comments
Open

Setup unit tests routine #71

alkurbatov opened this issue May 11, 2020 · 4 comments
Assignees
Milestone

Comments

@alkurbatov
Copy link
Member

We have lots of code which could be tested in some way, e.g. the new filters. Unfortunately, the only tests we have are functional requiring launch of a game client.

This task is about setting up a number of small unit test suites to check at least the filters.

@alkurbatov alkurbatov added this to the v1.4.0 milestone Jun 6, 2020
@alkurbatov alkurbatov modified the milestones: v1.4.1, v1.4.0 Feb 22, 2021
@alkurbatov
Copy link
Member Author

Well, the simplest way possible is to add GoogleTest as submodule and drop all that hand-maderoutine the Blizzard devs wrote. While this will be not real unit-tests (we need a running client for run), we can add basic unit-tests, too.

@alkurbatov alkurbatov self-assigned this Oct 4, 2021
@alkurbatov alkurbatov modified the milestones: v1.4.0, v1.4.1, v1.5.0 Oct 7, 2021
@alkurbatov alkurbatov modified the milestones: v1.5.0, v2.0.0 Aug 6, 2022
@Nickrader
Copy link
Contributor

Nickrader commented Nov 16, 2023

https://github.com/Nickrader/cpp-sc2/tree/dev_unittest

I started off trying to implement a unit test routine. I have since moved the goalpost to completing a sample, covering the different test types in the GTest framework.
[ it's taking me a long time to translate between Google documentation and our API, since it's my first go at GTest and real-world code].

Think I'm far enough to open it up for feedback/future direction. Figured getting a sample done first would make it more accessible for future contributors.

Currently still a work-in-progress.

P.S. I've learned more about CMake recently, so I'll have to go over that again.

@alkurbatov
Copy link
Member Author

alkurbatov commented Nov 17, 2023

First of all, this is definitely a good attempt and nice way to get useful experience.
Regarding the code the original idea is the following:

  1. Link with googletest (seems that we should use FetchContent here as I saw quite a lot of problems with "simple install googletest").
  2. Use the same flag (BUILD_API_TEST) to build all kinds of tests (requires large rewrite).
  3. Replace custom test routine in the integration tests with google test things.
  4. Add some unit tests (e.g. for unit filters) just to test that it works.
  5. Add unit-tests run into github CI.

I am totally ok if you wish to implement some points from this list as whole list could take a while.

@alkurbatov
Copy link
Member Author

By the way, perhaps you may find Catch2 more convenient to use in tests:
https://github.com/catchorg/Catch2/blob/devel/docs/tutorial.md

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

2 participants