Bizim Boost tabanlı Test yapısı aşağıdaki gibidir: nasıl eklemek ve bu yapı biz test ne bir vaka ile ayrı ayrı karar vermek zorunda eski projesi için seçildi
ProjectRoot/
Library1/
lib1.vcproj
lib1.cpp
classX.cpp
...
Library2/
lib2.vcproj
lib2.cpp
toolB.cpp
classY.cpp
...
MainExecutable/
main.cpp
toolA.cpp
toolB.cpp
classZ.cpp
...
Tests/
unittests.sln
ut_lib1/
ut_lib1.vcproj (referencing the lib1 project)
ut_lib1.cpp (with BOOST_AUTO_TEST_CASE) - testing public interface of lib1
ut_classX.cpp - testing of a class or other entity might be split
into a separate test file for size reasons or if the entity
is not part of the public interface of the library
...
ut_lib2/
ut_lib2.vcproj (referencing the lib2 project)
ut_lib2.cpp (with BOOST_AUTO_TEST_CASE) - testing public interface of lib2
...
ut_toolA/
ut_toolA.vcproj (referencing the toolA.cpp file)
ut_toolA.cpp - testing functions of toolA
ut_toolB/
ut_toolB.vcproj (referencing the toolB.cpp file)
ut_toolB.cpp - testing functions of toolB
ut_main/
ut_main.vcproj (referencing all required cpp files from the main project)
ut_classZ.cpp - testing classZ
...
Mevcut kaynak kodları için grup testi projeleri.
Unutulmaması gereken nokta:
- Birim Test kodu daima üretim kodu ayrı derlenmektedir.
- Üretim projeleri ünite test kodunu referans almaz.
- Birim Test projeleri, belirli bir kod dosyasının kullanımı dikkate alındığında ne mantıklı olduğuna bağlı olarak, kaynak dosyaları doğrudan veya yalnızca referans kitaplıklarını içerir.
- Ünite testlerinin çalıştırılması her bir ut yolunda bir inşa sonrası adım ile yapılır _ *. Vcproj
- Tüm üretimimiz otomatik olarak ünite testlerini de çalıştırır. (Bizim derleme dosyalarımızda.)
Gerçek (C++) dünyamızda, btw'leri tradeoff yapmak zorundasınız. eski sorunlar, geliştirici kolaylığı, derleme zamanları, vb. Proje yapımızın iyi bir tradeoff olduğunu düşünüyorum. :-)
Alternatif çok hataya eğilimli! – Wartin
ProjectRoot bağımlılıkları hakkında neler? ProjectRoot'un diğer tüm testlere dayanan bir ProjectRoot Testleri var mı? – JBRWilkinson