Learning cppunit testing framework

Source: Internet
Author: User
After learning the vs2005 test framework last time, I want to apply it. Find the essential
The stack example in Chapter 4th of C ++ found a bunch of errors during compilation.

It seems to be related to the # include of the file to be tested, because there is no similar error prompt after you comment out these # include.

However, the source code cannot run correctly.

On the one hand, I am asking for help on the Internet. On the other hand, I feel that the vs2005 testing framework may be better applied on C #, but it may not be better on C ++.

This reminds me of the famous cppunit, a test framework dedicated to C ++.

I found several entry-level articles on the Internet and read them carefully.

Cppunit testing framework entry

Http://blog.csdn.net/cpluser/archive/2004/09/21/111522.aspx

Build and use cppunit under vs2005

Http://blog.csdn.net/dk123/archive/2008/07/18/2673336.aspx

Preparations for using cppunit in vs2005

Http://hi.baidu.com/jackyu2007/blog/item/c808f11e21e0fcf71ad576ae.html

 

The skipped articles include:

Convenient development tool cppunit Quick Start Guide

Http://www.ibm.com/developerworks/cn/linux/l-cppunit/

Cppunit Quick Start

Http://blog.csdn.net/freefalcon/archive/2006/05/25/753819.aspx

Appendix (appendix)-Win32 platform installation instructions

Http://morningspace.51.net/resource/cppunit/appendix.html#91

Cppunit cookbook

Http://cppunit.sourceforge.net/doc/lastest/cppunit_cookbook.html

How to Use cppunit for unit testing

Http://www.vckbase.com/document/viewdoc? Id = 1762

This article is based on the cppunit testing framework and cppunit quick start.

 

To sum up, cppunit uses the following processes:

1. Create test cases;

2. register the test case to test suite;

3. Generate the test suite test list;

4. Use testrunner to import and run the test list.

 

This process is indeed complicated. Each test case needs to be defined before implementation, and must be registered to test suite separately.

So far, I have not successfully conducted a cppunit test myself.

Cppunit is not as easy as the vs2005 test framework.

In addition to being depressed, I saw everyone's comments on cppunit. For example, this article

C ++ testing framework Selection

Http://www.cppblog.com/jinq0123/archive/2010/04/13/112430.html

Cppunit has the largest workload in terms of workload.

 

My ideal test framework is to be simple, so that I can focus on the development of test cases.

 

On the Internet, I also saw a lot of people who recommended Google's testing framework. Comparing cppunit, it is much simpler.

For example, this article

Recommendation of a C ++ unit test framework-Google test

Http://hi.baidu.com/chendeping/blog/item/9a029efa7198a1d6b48f3182.html

The cppunit example here is the simplest example I have seen.

In my own blog post in February 9, I also said: "Google test is better than cppunit. I am reading Google test ."

Day! Go around and go back to Google test.

I also heard that gtest can work with Google mock for better use.

Easily write c ++ Unit Tests

Http://www.ibm.com/developerworks/cn/linux/l-cn-cppunittest/index.html

 

I will not look for other testing frameworks any more. I 'd like to study Google test first. I will talk about it later.

I also like the vs2005 test framework. I will study it if I have time.

From gtest to vs2005 test to cppunit to gtest, this process is not redundant. In this process, I learned more about unit testing and more examples to broaden my horizons.

In a word, there is no end to learning.

 

In addition, I think there are still few online resources for unit testing.

This is probably because there are few people doing this, and the people doing unit tests seem to be busy, and there is no time to do evangelism. You still have to perform unit testing on your own.

What's even more depressing is that foreign websites are not accessible, especially Google websites.

Original article: http://blog.csdn.net/dijchen/article/details/5706256

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.