×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    23

    how to use QTestLib for Unit testing an exe

    Hi All

    I am writing a test app for testing a class in an exe (not a lib).

    I am able to add the required headers for the class, but how to include an exe in the pro file of my test app(like we add our .lib in LIBS )??

    2) should I add all the .cpp and all .h files of my exe in the test app?


    Thanks in adv
    Kalyani

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: how to use QTestLib for Unit testing an exe


  3. #3
    Registered User
    Join Date
    Apr 2010
    Posts
    23

    Re: how to use QTestLib for Unit testing an exe

    Hi

    Thanks for ur reply
    But the exampoles show the testcases for a QString class in a library.
    But my doubt is if I need to write a testapp for an exe, what I need to do in the pro file? what files i need to include.

  4. #4
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: how to use QTestLib for Unit testing an exe

    Quote Originally Posted by pkalyani View Post
    But the exampoles show the testcases for a QString class in a library.
    What could be a difference?

  5. #5
    Registered User
    Join Date
    Apr 2010
    Posts
    23

    Re: how to use QTestLib for Unit testing an exe

    It has the difference i guess
    if we are testing a library class, we include that lib in LIBS +=

    But for an exe, what should be done?

    Also, sometimes when I compiles my testapp, I get

    mwldsym2.exe: Undefined symbol: '_main'
    mwldsym2.exe: referenced from 'int QtMainWrapper(void) (?QtMainWrapper@@YAHXZ)' in qts60main_mcrt0.cpp:86 (qtmain.lib)

    what could be the cause for it (we dnt write main () function in a test app, rite?"

    Thnaks
    Kalyani

  6. #6
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: how to use QTestLib for Unit testing an exe

    Quote Originally Posted by pkalyani View Post
    It has the difference i guess
    if we are testing a library class, we include that lib in LIBS +=
    Do you see LIBS in the project file?
    http://qt.gitorious.org/qt/qt/blobs/.../tutorial5.pro

    Quote Originally Posted by pkalyani View Post
    Also, sometimes when I compiles my testapp, I get

    mwldsym2.exe: Undefined symbol: '_main'
    mwldsym2.exe: referenced from 'int QtMainWrapper(void) (?QtMainWrapper@@YAHXZ)' in qts60main_mcrt0.cpp:86 (qtmain.lib)

    what could be the cause for it
    I have to see application to find the exact reason.

    Quote Originally Posted by pkalyani View Post
    (we dnt write main () function in a test app, rite?"
    Could you please elaborate this question?

  7. #7
    Registered User
    Join Date
    Apr 2010
    Posts
    23

    Re: how to use QTestLib for Unit testing an exe

    Hi


    No, I dnt see LIBS += in the respective pro file in the example code.
    But my qns problem is :

    My folder \ MyApplication (an exe)
    TestApp (to test the exe)


    So, do I need to include .h files and .cpp files from MyApplication, in the pro file of TestApp ?

    2) In all the test examples in the tutorial, there is no main ( ) function written.So, I am presuming that we dnt use main ( ) at all in test apps.Am I correct?

  8. #8
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: how to use QTestLib for Unit testing an exe

    Quote Originally Posted by pkalyani View Post
    No, I dnt see LIBS += in the respective pro file in the example code.
    But my qns problem is :

    My folder \ MyApplication (an exe)
    TestApp (to test the exe)

    So, do I need to include .h files and .cpp files from MyApplication, in the pro file of TestApp ?
    Yes, you need that and it's basically enough.

    Quote Originally Posted by pkalyani View Post
    2) In all the test examples in the tutorial, there is no main ( ) function written.So, I am presuming that we dnt use main ( ) at all in test apps.Am I correct?
    No, you are not. QTEST_MAIN macro expands to main()
    http://doc.trolltech.com/4.6/qtest.html#QTEST_MAIN

Similar Threads

  1. Replies: 1
    Last Post: 2010-10-13, 05:22
  2. JBoss Fights to Retain Its Title in the Testing Tools Category
    By rajesh5575 in forum General Development Questions
    Replies: 1
    Last Post: 2010-03-31, 13:17
  3. Killing an Exe during boot time
    By santosh shetty in forum Symbian
    Replies: 2
    Last Post: 2006-06-13, 05:48
  4. Testing an EXE that looks for a file
    By ViruDoshi in forum Symbian
    Replies: 2
    Last Post: 2006-01-30, 10:52
  5. Testing with an EXE
    By ViruDoshi in forum Symbian
    Replies: 1
    Last Post: 2006-01-01, 15:55

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×