Click here to Skip to main content
15,896,063 members
Articles / Mobile Apps

Unit Testing Framework for eVC++ Applications

Rate me:
Please Sign up or sign in to vote.
4.63/5 (13 votes)
17 Oct 2004CPOL6 min read 85.4K   246   28  
A unit testing framework for eVC++ applications, and its usage.
/******************************************************************************
 * File Name:		TestCaseInfo.h
 * Description:		This file contains the definition of CTestCaseInfo class.
 * Date:			20/7/2004
 * Author:			AbdulMunaf Chhatra
 * E-Mail:			a.chhatra@popnet.co.in
 *
 * Warning:
 * This code is provided as is without any guarantee or warranty, implicit or 
 * explicit. If this code damages your system then the author is not 
 * responsible for it. This code is free to use with the permission of author. 
 * If you want to use this code then please send me an email at 
 * a.chhatra@popnet.co.in for permission, I will gladly give the permission. 
 * If you make any changes in this code, then feel free to add your name here, 
 * but this notice should appear in this code.
 ******************************************************************************
 * ------------------------------
 * Version History
 * ------------------------------
 * Version	:  1.0
 * Author	:  AbdulMunaf Chhatra
 * Date    	:  20/7/2004
 * Comment 	:  Initial release
 * ------------------------------
 *****************************************************************************/
 

#if !defined(AFX_TESTCASEINFO_H__92A4806A_1A96_4797_A629_5E7E175B16E9__INCLUDED_)
#define AFX_TESTCASEINFO_H__92A4806A_1A96_4797_A629_5E7E175B16E9__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CTestSuite;

/******************************************************************************
 * This class stores the data about the test case.
 *****************************************************************************/
class CTestCaseInfo  
{
public:

	//Default constructor.
	CTestCaseInfo();

	//Destructor.
	virtual ~CTestCaseInfo();

	//Stores the address of the test case function in to the member variable.
	void SetTestCase( void (CTestSuite::*pTestCase) () );

	//Returns the address of the test case function.
	void GetTestCase( void (CTestSuite::*pTestCase) () );

	//Sets the test case name.
	void SetTestName( CString strTestName);

	//Returns the test case name.
	CString GetTestName();

	//Sets that the test should throw some exception.
	void SetExceptionFlag( BOOL bException);

	//Returns the exception flag.
	BOOL GetExceptionFlag();
	
	//Sets the name of exception name which the test should throw.
	void SetExceptionName( CString strException);

	//Returns the name of exception name which the test should throw.
	CString GetExceptionName();
	
	//Comapres the test case name with the string passed to it.
	BOOL CompareTestName( CString strName);

    //overloaded = operator.
    void operator =(CTestCaseInfo objSource);

	void (CTestSuite::*m_pTestCase) ();		//Pointer to the test case function.
	
private: //Member variables
	CString		m_strTestName;			//Name of the test case.
	BOOL		m_bException;			//Flag for exception.
	CString		m_strException;			//Exception name.
};



#endif // !defined(AFX_TESTCASEINFO_H__92A4806A_1A96_4797_A629_5E7E175B16E9__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
India India
A person who like to know about new things, peolple and make frineds. I strarted programming in 2000 with fortran but my first love in programming is C++. Also programmed in VB, MFC and for Windows CE.

Graduated in Physics and done masteres in Computer application. Physics and astronomy are my area of intrest. Karate is also one of my hobbies, BTW I am a Black Belt in Karate.

Comments and Discussions