www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Testing D codes

reply Russel Winder via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> writes:
Are there any resources dealing with how to do integration and system
testing of D codes? Google invariably just leads me to unit testing.

--=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=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   voip: sip:russel.winder ekiga.n=
et
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
Apr 04 2017
parent reply Kagamin <spam here.lot> writes:
Same as anywhere else. Integration test is a test that connects 
to a deployed system, which is different from unittest only in 
philosophical aspect.
Apr 04 2017
parent reply Russel Winder via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> writes:
On Tue, 2017-04-04 at 15:23 +0000, Kagamin via Digitalmars-d-learn
wrote:
 Same as anywhere else. Integration test is a test that connects=C2=A0
 to a deployed system, which is different from unittest only in=C2=A0
 philosophical aspect.
Well according to the standard definitions connecting to a deployed system would be a system test rather than an integration test =E2=80=93 but then there are probably twice as many meanings to these terms as there are programmers. However the question remains are there any examples of good integration and system testing of D codes out there in the wild to use as exemplars. --=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=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 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Apr 06 2017
parent reply Kagamin <spam here.lot> writes:
https://github.com/ikod/dlang-requests/blob/master/tests/app.d
Apr 06 2017
parent reply Russel Winder via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> writes:
On Thu, 2017-04-06 at 13:08 +0000, Kagamin via Digitalmars-d-learn
wrote:
 https://github.com/ikod/dlang-requests/blob/master/tests/app.d
Which implies that in the D milieu all tests are unittests even if they are not unittests. Sad use of terminology and jargon, but I can see it working. Is there any need for the unittest block in the application created to run the integration tests? --=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=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 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Apr 06 2017
next sibling parent reply drug <drug2004 bk.ru> writes:
06.04.2017 16:49, Russel Winder via Digitalmars-d-learn пишет:
 On Thu, 2017-04-06 at 13:08 +0000, Kagamin via Digitalmars-d-learn
 wrote:
 https://github.com/ikod/dlang-requests/blob/master/tests/app.d
Which implies that in the D milieu all tests are unittests even if they are not unittests. Sad use of terminology and jargon, but I can see it working. Is there any need for the unittest block in the application created to run the integration tests?
I'm not sure about terminology too, but did you try some like https://code.dlang.org/packages/unit-threaded? I use it and am satisfied.
Apr 06 2017
parent reply Russel Winder via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> writes:
On Thu, 2017-04-06 at 16:57 +0300, drug via Digitalmars-d-learn wrote:
=20
[=E2=80=A6]
 I'm not sure about terminology too, but did you try some like=C2=A0
 https://code.dlang.org/packages/unit-threaded?
 I use it and am satisfied.
I was slowly sidling up to using this as the inbuilt system is a tad primitive. Useful, but primitive. At some point though shrinking is going to have to be implemented for the property-based testing stuff in unit-threaded. The sandbox is looking most useful for integration tests. I am still wondering about separating integration and system tests out of the module source leaving the unit tests in the module source. =20 --=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=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 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Apr 06 2017
parent reply drug <drug2004 bk.ru> writes:
06.04.2017 19:34, Russel Winder via Digitalmars-d-learn пишет:
 I am still wondering about separating integration and system tests out
 of the module source leaving the unit tests in the module source.
I do this. I have unittests in the module sources and have a separate subpackage intended for more advanced testing only.
Apr 07 2017
parent reply Russel Winder via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> writes:
On Fri, 2017-04-07 at 11:40 +0300, drug via Digitalmars-d-learn wrote:
=20
[=E2=80=A6]
 I do this. I have unittests in the module sources and have a
 separate=C2=A0
 subpackage intended for more advanced testing only.
Do you have an example project I could take a look at? --=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=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 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Apr 10 2017
parent drug <drug2004 bk.ru> writes:
10.04.2017 19:20, Russel Winder via Digitalmars-d-learn пишет:
 On Fri, 2017-04-07 at 11:40 +0300, drug via Digitalmars-d-learn wrote:

 […]
 I do this. I have unittests in the module sources and have a
 separate
 subpackage intended for more advanced testing only.
Do you have an example project I could take a look at?
Unfortunately it's proprietary code. It's like this: ``` module tests; import std.datetime: dur; import core.thread: Thread; import unit_threaded.runner; import unit_threaded: TestCase, shouldEqual; class Fixture: TestCase { override void setup() { // do common things for derived test } } class TestToiDataSerialization: Fixture { override void test() { // the test, is using setup() of the fixture above } } class TestCommandMessageSerialization: Fixture { override void test() { // and so on } } class TestNetworking: Fixture { override void test() { // and so on } } int main(string[] args) { import std.experimental.logger: LogLevel, globalLogLevel; try { globalLogLevel = LogLevel.fatal; return args.runTests!( "tests", // run all tests (three in this case) of the `tests` module (this module) ); } catch(Exception e) { import std.stdio: stderr; stderr.writeln(e.msg); return 1; } } ``` You can place some tests in other module, then this module should be added to runner.
Apr 10 2017
prev sibling parent Kagamin <spam here.lot> writes:
On Thursday, 6 April 2017 at 13:49:11 UTC, Russel Winder wrote:
 Is there any need for the unittest block in the application 
 created to run the integration tests?
If you don't care to call each and all of them by hand. Test frameworks are handy for extensive testing, builtin unittests work best for the most basic stuff.
Apr 07 2017