Skapa Boost-tester

För att bygga och köra Boost-tester måste du installera Boost.Test på datorn. Vanligtvis ingår det i Boost-installationen. Ladda ner Boost från Boost.org.

Om kompilatorn och byggsystemet kan hitta Boost-biblioteken behöver du inte ange inkluderingskatalogen när du skapar testet.

Så här skapar du ett Boost-test:

  1. Gå till File > New Project > Test Project.
  2. Välj Boost Test Project > Choose för att skapa ett projekt med standardkod för ett Boost-test.
  3. I dialogrutan Project and Test Information anger du inställningar för projektet och testet:

    Dialogrutan ”Projekt- och testinformation” i guiden för Boost-testprojekt

    1. I Test framework väljer du Boost Test (header only) för att inkludera nödvändiga huvudfiler, eller Boost Test (shared libraries) för att länka mot Boost Test.
    2. I Test suite name anger du ett namn för testsuiten.
    3. I Test case name anger du ett namn för testfallet.
    4. I Boost include directory (optional) anger du sökvägen till den katalog som innehåller de filer som Boost.Test behöver, till exempel version.hpp och undermappen test som innehåller testhuvudfilerna.
    5. I Build system väljer du vilket byggsystem som ska användas för att bygga projektet: CMake, qmake eller Qbs.

Qt Creator skapar testet i projektkatalogen.

För mer information om hur man skapar Boost-tester, se Boost.Test.

Obs! När testerna söks igenom tar parsern endast hänsyn till filer som direkt eller indirekt inkluderar någon av Boosts testbiblioteksheaders (alla inkluderingar som börjar med boost/test/ och har suffixet .hpp ). Filer som för närvarande inte kommer att byggas ignoreras.

Se även Så här gör du: Testa, Välj byggsystem och Testning.

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.