• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
    • 軟件測試技術
    • 軟件測試博客
    • 軟件測試視頻
    • 開源軟件測試技術
    • 軟件測試論壇
    • 軟件測試沙龍
    • 軟件測試資料下載
    • 軟件測試雜志
    • 軟件測試人才招聘
      暫時沒有公告

    字號: | 推薦給好友 上一篇 | 下一篇

    cppunit在linux下的安裝使用

    發布: 2009-9-21 18:14 | 作者: 不祥 | 來源: 轉載 | 查看: 329次 | 進入軟件測試論壇討論

    領測軟件測試網

    OS :ubuntu9.04
    CppUnit :cppunit-1.12.1
    1、 下載、解壓
         到http://sourceforge.net/projects/cppunit下載,然后復制cppunit-1.11.6.tar.gz到/usr/src;  
        運行:tar -xf cppunit-1.10.2.tar.gz 解壓縮;或者在WIN下直接解壓
    2 、安裝
    進入cppunit-1.11.6目錄下。依次運行下列命令
          A :./configure;  
    B :make;
          C :make check;
          D:make install
    3、 copy *.h 文件
        .o, .a文件已經安裝到/usr/local/lib中去了,但頭文件沒安裝到/usr/include中去
    把cppunit-1.10.2的cppunit目錄復制到/usr/include下
    4 、導入lib
    運行時要先設置環境變量LD_LIBRARY_PATH到cppunit的安裝目錄,也就是/usr/local/lib,命令如下:
           export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
    5、 編寫測試程序
    testApp.cpp
    #include <iostream>
     
    #include <cppunit/TestRunner.h>
    #include <cppunit/TestResult.h>
    #include <cppunit/TestResultCollector.h>
    #include <cppunit/extensions/HelperMacros.h>
    #include <cppunit/BriefTestProgressListener.h>
    #include <cppunit/extensions/TestFactoryRegistry.h>
     
     
    class Test : public CPPUNIT_NS::TestCase
    {
     CPPUNIT_TEST_SUITE(Test);
     CPPUNIT_TEST(testHelloWorld);
       CPPUNIT_TEST_SUITE_END();
     
     public:
       void setUp(void) {}
       void tearDown(void) {}
     
     protected:
       void testHelloWorld(void) { std::cout << "Hello, world!" << std::endl; }
     };
     
     CPPUNIT_TEST_SUITE_REGISTRATION(Test);
     
     int main( int argc, char **argv )
     {
       // Create the event manager and test controller
       CPPUNIT_NS::TestResult controller;
     
       // Add a listener that colllects test result
       CPPUNIT_NS::TestResultCollector result;
     controller.addListener( &result );       
     
       // Add a listener that print dots as test run.
       CPPUNIT_NS::BriefTestProgressListener progress;
       controller.addListener( &progress );     
     
       // Add the top suite to the test runner
       CPPUNIT_NS::TestRunner runner;
       runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
       runner.run( controller );
     
       return result.wasSuccessful() ? 0 : 1;
     }
    6 、編譯,運行
       有兩種方法
        (a) 鏈接靜態庫。編譯命令:
          g++ -L/usr/local/lib/libcppunit.a testApp .cpp -lcppunit -ldl -o testApp
        運行:
          ./ testApp
        結果:
        
          : OK
        (b) 鏈接動態庫。編譯命令:
           g++ testApp .cpp -lcppunit -ldl -o testApp
        然后運行:
           ./ testApp
        結果:
           Test::
             : OK
    7、 其他例子
    在cppunit-docs-1.11.6中有文檔money_example.html,該文檔詳細的介紹了測試、開發的過程;
    轉載:http://blog.csdn.net/lengxingfei/archive/2006/04/19/669659.aspx

    本文來自CSDN博客,轉載請標明出處:http://blog.csdn.net/Leeiee/archive/2009/07/07/4327741.aspx

    延伸閱讀

    文章來源于領測軟件測試網 http://www.kjueaiud.com/


    關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
    版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
    北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備2023014753號-2
    技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

    軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>