Jump to content
  • Advertisement
Sign in to follow this  
Endar

testing framework

This topic is 4267 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Since re-writing my engine is going to be a big deal, I'd like to write a framework for testing and I'm not really sure how to go about it. I've thought of a simple class:
template<class T>
class TestCase
{
private:

	std::string m_testDescription;		///< A string describing the test

public:

	/**
	 * Constructor
	 * \param s The description that this test object will perform
	 */
	TestCase(const std::string& s)
		:	m_testDescription(s)
	{	}

	/**
	 * Perform the test
	 * \param obj The object to perform the test on
	 * \return Whether the test passed or not
	 */
	virtual bool test( T& obj ) const = 0;

};


Something like that so I can just create a small new class, that derives from 'TestCase', for each test. I'll have to define the constructor and the 'test' function for each different test that I do. I'll probably need something more complicated in the future, but I was just wondering how this was for a start? Or, if you've got any ideas for the future, definately chime in.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
These are commonly known as "mock up" objects, in general however you may want to simply do a forum search for "unit testing", likewise checking out the corresponding wikipedia matches for "unit test*" and "test driven development" might also be worthwhile thing to do.

HTH

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You may consider using UnitTest++ (http://unittest-cpp.sourceforge.net/). I haven't used it personally yet, but I know some people that swear on it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!