[test] Fixtures from file

Hi, I need to open fixture file (e.g. the one that contains initial data for testing) in a BOOST_AUTO_TEST_CASE. Could you please tell: * Whether it's possible? * If possible, than what is the most preferable way to do it? JFYI: We need to have something like python django fixtures. Some details: https://docs.djangoproject.com/en/dev/topics/testing/?from=olddocs#django.te... Regards

Hi Alexander, On Saturday, 7. April 2012 13:27:21 Alexander Arhipenko wrote:
I need to open fixture file (e.g. the one that contains initial data for testing) in a BOOST_AUTO_TEST_CASE. Could you please tell: * Whether it's possible?
Opening files is possible, you can add them to the commandline and access it with namespace utf = boost::unit_test::framework; utf::master_test_suite().argv utf::master_test_suite().argc
* If possible, than what is the most preferable way to do it?
That depends on your use case.
JFYI: We need to have something like python django fixtures.
Interesting article, thanks for the link. I think you have to code the basic functionality of this yourself into a (global) Boost.Test fixture. This fixture can setup the needed environment. Hope this helps, Yours, Jürgen -- * Dipl.-Math. Jürgen Hunold ! * voice: ++49 4257 300 ! Fährstraße 1 * fax : ++49 4257 300 ! 31609 Balge/Sebbenhausen * jhunold@gmx.eu !

On Tue, Apr 10, 2012 at 12:59 PM, Jürgen Hunold <jhunold@gmx.eu> wrote:
Hi Alexander,
Hi Jurgen,
[snip]
Opening files is possible, you can add them to the commandline and access it with
namespace utf = boost::unit_test::framework; utf::master_test_suite().argv utf::master_test_suite().argc
[snip] Thanks for the hint, that worked for me. Unfortunately, functionality for accessing the file (i.e. find by name in argv and open afterwards) is not built into unit test framework, so it should be implemented from scratch. Regards
Jürgen -- * Dipl.-Math. Jürgen Hunold ! * voice: ++49 4257 300 ! Fährstraße 1 * fax : ++49 4257 300 ! 31609 Balge/Sebbenhausen * jhunold@gmx.eu !
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (2)
-
Alexander Arhipenko
-
Jürgen Hunold