digitalmars.D.learn - Integration testing, unit-threaded, and threads
- Russel Winder (22/22) Apr 23 2020 Hi,
- drug (6/24) Apr 23 2020 I would use Fixture (a class derived form TestCase) here and derive all
- drug (2/3) Apr 23 2020 terminate it after in `shutdown()`
- Russel Winder (13/15) Apr 23 2020 Oh f###, that is about the only combination I didn't try. :-(
Hi, I need to start a process before the tests run, and terminate it after the tests run. A module with a shared static constructor and shared static destructor sounds like the way of doing this since the constructor is run before main and the destructor after main. However I am using unit-threaded, not for the threads but because it is great for a whole load of other reasons. In fact the threads are becoming a problem. As far as I can tell main is terminating before all the tests are complete which means the shared static destructor is executing before all the tests are complete. To test this hypothesis I want to run single threaded. unit-threaded says this is possible using a command line option -s. The question is which command line? dub test doesn't accept it and neither does the dub command creating ut_main.d --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Road m: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk
Apr 23 2020
23.04.2020 14:01, Russel Winder пишет:Hi, I need to start a process before the tests run, and terminate it after the tests run. A module with a shared static constructor and shared static destructor sounds like the way of doing this since the constructor is run before main and the destructor after main. However I am using unit-threaded, not for the threads but because it is great for a whole load of other reasons. In fact the threads are becoming a problem. As far as I can tell main is terminating before all the tests are complete which means the shared static destructor is executing before all the tests are complete.I would use Fixture (a class derived form TestCase) here and derive all tests from it. It allows you to start your process before all test in `setup()` Fixture member and terminate it after in `` and probably lets you run the tests simultaneously.To test this hypothesis I want to run single threaded. unit-threaded says this is possible using a command line option -s. The question is which command line? dub test doesn't accept it and neither does the dub command creating ut_main.dDid you try `dub test -- -s`?
Apr 23 2020
23.04.2020 14:41, drug пишет:terminate it after in ``terminate it after in `shutdown()`
Apr 23 2020
On Thu, 2020-04-23 at 14:41 +0300, drug via Digitalmars-d-learn wrote:=20[=E2=80=A6]Did you try `dub test -- -s`?Thanks. Problem solved. :-) Not sure about the Fixture proposal, I will research and cogitate further. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Road m: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk
Apr 23 2020