Re: EgTest: quick & easy unit tests

"Russell Gold [email protected] [junit]" <[email protected]> Thu, 30 Mar 2017 16:23:45 -0400
Newsgroups gmane.comp.java.junit.user
Message-ID <[email protected]>
--Apple-Mail=_429AF71C-6AD7-4CF7-A014-103D6F6D0AC0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

This is at least an intriguing idea, although I really hate the idea of giv=
ing programmers another excuse for not writing full-on unit tests, or devel=
oping test-first.  Do you have examples of what this looks like in the Java=
doc? That seems as though it would be a great use for it. That is, rather t=
han making unit testing =E2=80=9Cexcuse-free,=E2=80=9D as you say, it would=
 have the primary intent of adding examples to Javadoc, while verifying tha=
t those examples actually work. I know that I have run into problems that w=
ay - I=E2=80=99ve written examples, only to have developers ask me for help=
 because there was a typo in my documentation.=20

- Russ

-----------------
Author, Getting Started with Apache Maven <http://www.packtpub.com/getting-=
started-with-apache-maven/video>
Author, HttpUnit <http://www.httpunit.org> and SimpleStub <http://simplestu=
b.meterware.com>
Now blogging at <http://agilementor.us/blog/>

Have you listened to Edict Zero <https://edictzero.wordpress.com>? If not, =
you don=E2=80=99t know what you=E2=80=99re missing!

> On Mar 10, 2017, at 6:29 PM, David Leppik [email protected] [junit] <junit=
@yahoogroups.com> wrote:
>=20
> I have a new framework which combines unit tests and documentation in sou=
rce code. The goal is to make unit testing "excuse-free:" i.e. so simple th=
at they become the lazy way to spot-check code, while ensuring that example=
s in Javadoc are automatically tested.
>=20
>=20
> This is a complementary way to write certain simple tests, rather than a =
full-on replacement for hand-writing JUnit tests.
>=20
>=20
>=20
>=20
> https://github.com/dleppik/EgTest
>=20
>=20
>=20
>=20
> A quick example; this would be found in a main (non-test) Java file:
>=20
>=20
> @Eg(given =3D {"1", "2"}, returns =3D "3")
> @Eg(given =3D {"1", "Integer.MAX_VALUE"}, returns =3D "Integer.MIN_VALUE"=
)
> static int add(int a, int b) {
>    return a + b;
> }
>=20
>=20
> The above annotations show up in Javadoc and they produce a JUnit test wh=
ich tests the assertions on the add method.
>=20
>=20
> Any feedback would be extremely welcome. This is early enough that it's n=
ot too late to change the syntax or nomenclature if there's a better way to=
 go about it.
>=20
>=20
>=20
>=20
> 	-Dave
>=20
>=20
> --
> David Leppik                                     http://www.leppik.net/da=
vid/blog/
> [email protected]
>=20
>=20
> "As a computer shrinks, the gravitational force that its components exert=
 on one another becomes stronger and eventually grows so intense that no ma=
terial object can escape."
> -- Scientific American, Nov 2004, p. 56
>=20
>=20
>=20
>=20
> ------------------------------------
> Posted by: David Leppik <[email protected]>
> ------------------------------------
>=20
>=20
> ------------------------------------
>=20
> Yahoo Groups Links
>=20
>=20
>=20


--Apple-Mail=_429AF71C-6AD7-4CF7-A014-103D6F6D0AC0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable





<head>

<style type=3D"text/css">
<!--

/* start of attachment style */
       .ygrp-photo-title{
         clear: both;
         font-size: smaller;
         height: 15px;
         overflow: hidden;
         text-align: center;
         width: 75px;
       }
       div.ygrp-photo{
         background-position: center;
         background-repeat: no-repeat;
         background-color: white;
         border: 1px solid black;
         height: 62px;
         width: 62px;
       }

       div.photo-title=20
         a,
         div.photo-title a:active,
         div.photo-title a:hover,
         div.photo-title a:visited {
           text-decoration: none;=20
       }

       div.attach-table div.attach-row {
         clear: both;
       }

       div.attach-table div.attach-row div {
         float: left;
         /* margin: 2px;*/
       }

       p {
         clear: both;
         padding: 15px 0 3px 0;
	 overflow: hidden;
       }

       div.ygrp-file {
         width: 30px;
         valign: middle;
       }
       div.attach-table div.attach-row div div a {
         text-decoration: none;
       }

       div.attach-table div.attach-row div div span {
         font-weight: normal;
       }

       div.ygrp-file-title {
         font-weight: bold;
       }
 /* end of attachment style */
        -->
        </style>
        </head>
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D"">


<!-- |**|begin egp html banner|**| -->

<br><br>

<!-- |**|end egp html banner|**| -->


This is at least an intriguing idea, although I really hate the idea of giv=
ing programmers another excuse for not writing full-on unit tests, or devel=
oping test-first. &nbsp;Do you have examples of what this looks like in the=
 Javadoc? That seems as though it would be a great use for it. That is, rat=
her than making unit testing =E2=80=9Cexcuse-free,=E2=80=9D as you say, it =
would have the <i class=3D"">primary</i> intent of adding examples to Javad=
oc, while verifying that those examples actually work. I know that I have r=
un into problems that way - I=E2=80=99ve written examples, only to have dev=
elopers ask me for help because there was a typo in my documentation.&nbsp;=
<div class=3D""><br class=3D""></div><div class=3D"">- Russ<br class=3D""><=
div class=3D""><br class=3D""></div><div class=3D""><div style=3D"orphans: =
2; widows: 2;" class=3D"">-----------------</div><div style=3D"orphans: 2; =
widows: 2;" class=3D"">Author,&nbsp;Getting Started with Apache Maven &lt;<=
a href=3D"http://www.packtpub.com/getting-started-with-apache-maven/video" =
class=3D"">http://www.packtpub.com/getting-started-with-apache-maven/video<=
/a>&gt;</div><div style=3D"orphans: 2; widows: 2;" class=3D"">Author, HttpU=
nit &lt;<a href=3D"http://www.httpunit.org" class=3D"">http://www.httpunit.=
org</a>&gt; and SimpleStub &lt;<a href=3D"http://simplestub.meterware.com" =
class=3D"">http://simplestub.meterware.com</a>&gt;</div><div style=3D"orpha=
ns: 2; widows: 2;" class=3D"">Now blogging at &lt;<a href=3D"http://agileme=
ntor.us/blog/" class=3D"">http://agilementor.us/blog/</a>&gt;<br class=3D""=
><br class=3D""></div><div style=3D"orphans: 2; widows: 2;" class=3D"">Have=
 you listened to Edict Zero &lt;<a href=3D"https://edictzero.wordpress.com"=
 class=3D"">https://edictzero.wordpress.com</a>&gt;? If not, you don=E2=80=
=99t know what you=E2=80=99re missing!</div><div style=3D"orphans: 2; widow=
s: 2;" class=3D""><br class=3D""></div><div><blockquote type=3D"cite" class=
=3D""><div class=3D"">On Mar 10, 2017, at 6:29 PM, David Leppik <a href=3D"=
mailto:[email protected]" class=3D"">[email protected]</a> [junit] &lt;<a hre=
f=3D"mailto:[email protected]" class=3D"">[email protected]</a>&gt;=
 wrote:</div><br class=3D"Apple-interchange-newline"><div class=3D""><div c=
lass=3D"">I have a new framework which combines unit tests and documentatio=
n in source code. The goal is to make unit testing "excuse-free:" i.e. so s=
imple that they become the lazy way to spot-check code, while ensuring that=
 examples in Javadoc are automatically tested.<br class=3D""><br class=3D""=
><br class=3D"">This is a complementary way to write certain simple tests, =
rather than a full-on replacement for hand-writing JUnit tests.<br class=3D=
""><br class=3D""><br class=3D""><br class=3D""><br class=3D""><a href=3D"h=
ttps://github.com/dleppik/EgTest" class=3D"">https://github.com/dleppik/EgT=
est</a><br class=3D""><br class=3D""><br class=3D""><br class=3D""><br clas=
s=3D"">A quick example; this would be found in a main (non-test) Java file:=
<br class=3D""><br class=3D""><br class=3D"">@Eg(given =3D {"1", "2"}, retu=
rns =3D "3")<br class=3D"">@Eg(given =3D {"1", "Integer.MAX_VALUE"}, return=
s =3D "Integer.MIN_VALUE")<br class=3D"">static int add(int a, int b) {<br =
class=3D""> &nbsp;&nbsp;&nbsp;return a + b;<br class=3D"">}<br class=3D""><=
br class=3D""><br class=3D"">The above annotations show up in Javadoc and t=
hey produce a JUnit test which tests the assertions on the add method.<br c=
lass=3D""><br class=3D""><br class=3D"">Any feedback would be extremely wel=
come. This is early enough that it's not too late to change the syntax or n=
omenclature if there's a better way to go about it.<br class=3D""><br class=
=3D""><br class=3D""><br class=3D""><br class=3D""><span class=3D"Apple-tab=
-span" style=3D"white-space:pre">	</span>-Dave<br class=3D""><br class=3D""=
><br class=3D"">--<br class=3D"">David Leppik &nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;http://www.leppik.net/david/blog/<br c=
lass=3D"">[email protected]<br class=3D""><br class=3D""><br class=3D"">"As =
a computer shrinks, the gravitational force that its components exert on on=
e another becomes stronger and eventually grows so intense that no material=
 object can escape."<br class=3D"">-- Scientific American, Nov 2004, p. 56<=
br class=3D""><br class=3D""><br class=3D""><br class=3D""><br class=3D"">-=
-----------------------------------<br class=3D"">Posted by: David Leppik &=
lt;[email protected]&gt;<br class=3D"">------------------------------------<=
br class=3D""><br class=3D""><br class=3D"">-------------------------------=
-----<br class=3D""><br class=3D"">Yahoo Groups Links<br class=3D""><br cla=
ss=3D"">&lt;*&gt; To visit your group on the web, go to:<br class=3D""> &nb=
sp;&nbsp;&nbsp;http://groups.yahoo.com/group/junit/<br class=3D""><br class=
=3D"">&lt;*&gt; Your email settings:<br class=3D""> &nbsp;&nbsp;&nbsp;Indiv=
idual Email | Traditional<br class=3D""><br class=3D"">&lt;*&gt; To change =
settings online go to:<br class=3D""> &nbsp;&nbsp;&nbsp;http://groups.yahoo=
.com/group/junit/join<br class=3D""> &nbsp;&nbsp;&nbsp;(Yahoo! ID required)=
<br class=3D""><br class=3D"">&lt;*&gt; To change settings via email:<br cl=
ass=3D""> &nbsp;&nbsp;&nbsp;[email protected] <br class=3D""> &n=
bsp;&nbsp;&nbsp;[email protected]<br class=3D""><br class=
=3D"">&lt;*&gt; To unsubscribe from this group, send an email to:<br class=
=3D""> &nbsp;&nbsp;&nbsp;[email protected]<br class=3D""><b=
r class=3D"">&lt;*&gt; Your use of Yahoo Groups is subject to:<br class=3D"=
"> &nbsp;&nbsp;&nbsp;https://info.yahoo.com/legal/us/yahoo/utos/terms/<br c=
lass=3D""><br class=3D""></div></div></blockquote></div><br class=3D""></di=
v></div>



<!-- |**|begin egp html banner|**| -->

<br>


<br>

<!-- |**|end egp html banner|**| -->


<div width=3D"1" style=3D"color: white; clear: both;"/>__._,_.___</div>

=20=20=20=20=20=20
=20=20

=20=20=20=20
    <div id=3D"fromDMARC" style=3D"clear:both; margin-top: 10px;">
         <hr style=3D"height:2px ; border-width:0; color:#E3E3E3; backgroun=
d-color:#E3E3E3;">
         Posted by: Russell Gold &lt;[email protected]&gt;         <hr sty=
le=3D"height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;=
">
    </div>
<!-- Start Recommendations -->
<!-- End Recommendations -->



<!-- |**|begin egp html banner|**| -->

  <img src=3D"http://geo.yahoo.com/serv?s=3D97476590/grpId=3D2423328/grpspI=
d=3D1705006905/msgId=3D24762/stime=3D1490905428" width=3D"1" height=3D"1"> =
<br>

<!-- |**|end egp html banner|**| -->

=20=20=20=20
<!-- |**|begin egp html banner|**| -->

<br>



=20=20=20
=20=20=20=20=20
=20
        <!-- |**|begin egp html banner|**| -->
        <div id=3D"ygrp-vital" style=3D"background-color: #f2f2f2; font-fam=
ily: Verdana; font-size: 10px; margin-bottom: 10px; padding: 10px;">

        <span id=3D"vithd" style=3D"font-weight: bold; color: #333; text-tr=
ansform: uppercase; "><a href=3D"https://groups.yahoo.com/neo/groups/junit/=
info;_ylc=3DX3oDMTJlbDZtNDdzBF9TAzk3MzU5NzE0BGdycElkAzI0MjMzMjgEZ3Jwc3BJZAM=
xNzA1MDA2OTA1BHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTQ5MDkwNTQyOA--" style=3D"tex=
t-decoration: none;">Visit Your Group</a></span>

     <ul style=3D"list-style-type: none; margin: 0; padding: 0; display: in=
line;">
            <li style=3D"border-right: 1px solid #000; font-weight: 700; di=
splay: inline; padding: 0 5px; margin-left: 0;">
      <span class=3D"cat"><a href=3D"https://groups.yahoo.com/neo/groups/ju=
nit/members/all;_ylc=3DX3oDMTJmdnJnMWZzBF9TAzk3MzU5NzE0BGdycElkAzI0MjMzMjgE=
Z3Jwc3BJZAMxNzA1MDA2OTA1BHNlYwN2dGwEc2xrA3ZtYnJzBHN0aW1lAzE0OTA5MDU0Mjg-" s=
tyle=3D"text-decoration: none;">New Members</a></span>
      <span class=3D"ct" style=3D"color: #ff7900;">1</span>
    </li>
                                              </ul>
  </div>


<div id=3D"ft" style=3D"font-family: Arial; font-size: 11px; margin-top: 5p=
x; padding: 0 2px 0 0; clear: both;">
  <a href=3D"https://groups.yahoo.com/neo;_ylc=3DX3oDMTJkb2t1cjZkBF9TAzk3ND=
c2NTkwBGdycElkAzI0MjMzMjgEZ3Jwc3BJZAMxNzA1MDA2OTA1BHNlYwNmdHIEc2xrA2dmcARzd=
GltZQMxNDkwOTA1NDI4" style=3D"float: left;"><img src=3D"http://l.yimg.com/r=
u/static/images/yg/img/email/new_logo/logo-groups-137x15.png" height=3D"15"=
 width=3D"137" alt=3D"Yahoo! Groups" style=3D"border: 0;"/></a>
  <div style=3D"color: #747575; float: right;"> &bull; <a href=3D"https://i=
nfo.yahoo.com/privacy/us/yahoo/groups/details.html" style=3D"text-decoratio=
n: none;">Privacy</a> &bull; <a href=3D"mailto:junit-unsubscribe@yahoogroup=
s.com?subject=3DUnsubscribe" style=3D"text-decoration: none;">Unsubscribe</=
a> &bull; <a href=3D"https://info.yahoo.com/legal/us/yahoo/utos/terms/" sty=
le=3D"text-decoration: none;">Terms of Use</a> </div>
</div>

<!-- |**|end egp html banner|**| -->

  </div> <!-- ygrp-msg -->

=20=20=20


  <br>

<!-- |**|end egp html banner|**| -->


<div style=3D"color: white; clear: both;"/>__,_._,___</div>
</body></html>
--Apple-Mail=_429AF71C-6AD7-4CF7-A014-103D6F6D0AC0--