0

I am looking for some ideas on how to implement a Unit Test framework without any existing unit test tools like Google Test Runner. I am on a closed network without internet access and so whatever method is determined needs to be hand written and configured.

  • 1
    I'm not familiar with dependency management for C++, but if it's anything like the tools available for Java (e.g. Maven, Gradle) you should be able to host dependencies in a repository inside your own network. Has this been considered/ruled out? As an example CMake apparently has a find_package method that looks in a local directory rather than a central repository. This seems like a more reasonable approach than rolling your own test framework. – anonygoose May 22 at 12:43
  • I've looked and asked around. We're going to try and figure out how to get something like the Google framework or Cute but just not sure if that will happen. I don't believe there is anything in our local repository. Just eclipse is used, they don't link up to any repository. – jiveturkey May 22 at 12:47
  • I agree with @anonygoose, this feels like a very odd question. Surely there is some way of getting tools from the outside world onto your internal network. Carried to the extreme, limiting yourself to the internal network would mean writing your own OS and programming language from scratch as well (just using this as an illustration that there's probably a better way to do this). – c32hedge May 22 at 14:31
  • 1
    I tend to agree with c32hedge that as the current question reads you need to code from scratch. As if you are in a nuclear bunker waiting on a post apocalypse event to go by. Maybe you can give a bit more context of why you need to develop something from scratch? – Niels van Reijmersdal May 24 at 8:48
1

There is a lot of documentation of how to build your own Unit Testing Framework, maybe this is a starting point: https://stackoverflow.com/questions/7049329/how-to-write-a-unit-test-framework

For Eclipse you could look at the code from other frameworks plugins to see how you can make your framework integration better with Eclipse.

Unit-tests mostly instantiates a class and calls some methods. Then there is a assert function for the result. You could write your own assert library, but I think C++ has one shipped by default in cassert.

You don't really need a test-runner. Probably a new C++ program with methods that execute code with asserts could be enough. Build, run the separate test program, verify it did not throw an assert exception with a try/catch. Of Course as your program grows a full-blown testing framework will make it easier to read failures.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.