Post by ahartmann on Dec 8, 2013 6:32:23 GMT -5
This is a quick tutorial to get TestApe with Qt Creator (a great cross-platform IDE based on the famous Qt libraries) running. I used Ubuntu Linux 12.04 32 bit.
The goal of this tutorial is to use the qmake-build system instead of writing Makefiles. Every file added to the project is automatically added to the build.
The goal of this tutorial is to use the qmake-build system instead of writing Makefiles. Every file added to the project is automatically added to the build.
- Install Ubuntu
- Install additional packages:
sudo apt-get install build-essential qt4-dev-tools - Qt Creator (download from http://www.qt-project.org)
I used the latest prelease 3.0-RC:
chmod +x qt-creator-opensource-linux-x86-3.0.0-rc1.run
./qt-creator-opensource-linux-x86-3.0.0-rc1.run - TestApe (I had to use force because dpkg complains about the
version number starting with 'r'):
sudo dpkg --force-bad-version -i testape_r880_i386.deb - Start Qt Creator
- Create a new "C-only" project:
- File --> New File or Project --> Non-Qt Project --> Plain C Project
- Name it e.g. HelloTestApe and click next until the project is generated
- Then modify the "HelloTestApe.pro" project file and add the following lines:
(Maybe this could be simplified by creating a "TestApe project wizard")
# link against the testape library
LIBS += -ltestape
# use testape gcc as link command
QMAKE_LINK = testape gcc - Open main.c, delete the existing content and write a simple HelloWorld application:
#include <testape.h>
int calc(void);
void test_addition(void)
{
ALLOW_SIMULATE(calc, 1);
int res = calc();
VALIDATE(res, 1);
}
void testmain(void)
{
EXECUTE(test_addition);
} - On the left sidebar, click "Projects" --> Run --> Uncheck the "Run in Terminal" checkbox
- Switch back to "Edit" mode by clicking "Edit" on the left side bar
- Press the green Run button on the left side bar or press Ctrl+R
- Creator builds, links with TestApe and then runs your project.
Starting /home/ubuntu/src/build-HelloTestApe-Desktop-Debug/HelloTestApe...testape: TestApe test executable
testape: Unit testing for embedded software - testape.com
testape:
testape: Test executable initializing
testape:
testape: Executing test testmain
testape:
testape: Executing test test_addition
testape:
testape: Allowing function calls to calc
testape: PASSED verify res
testape: expected .......... 1 (1)
testape: actual ............ 1
testape:
testape: PASSED test test_addition
testape:
testape: PASSED test testmain
testape:
testape:
testape:
testape: Test exeutable terminating
testape: exitcode 0
/home/ubuntu/src/build-HelloTestApe-Desktop-Debug/HelloTestApe exited with code 0