Jtr Fosdem 09

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    2 Favorites

    Jtr Fosdem 09 - Presentation Transcript

    1. Java Test Runner http://jtrunner.sourceforge.net Francesco Russo
    2. Testing matters... What is an error? \"Error is a difference between the desired and actual behavior or performance of a system or object\"
    3. But testing has different flavors
    4. Behavioral
    5. Integration
    6. System & Stress
    7. User acceptance
    8. ... and more
    9. JTR is... ... a dynamic testing tool suitable for: • integration / system testing • behavioral testing
    10. \"How can JTR help me?\"
    11. JTR lets you (stress-)test Standard Java™ classes
    12. JTR lets you (stress-)test Standard Java™ classes J2EE 1.4 Session Beans
    13. JTR lets you (stress-)test J2EE 1.4 Session Beans Standard Java™ classes JEE 5 Session Beans
    14. JTR lets you (stress-)test J2EE 1.4 Session Beans Standard Java™ classes Web Services JEE 5 Session Beans
    15. JTR lets you (stress-)test J2EE 1.4 Session Beans Standard Java™ classes Web Services JMS applications JEE 5 Session Beans
    16. Parameters matter
    17. JTR adopts Inversion of Control Push... ... not pull!
    18. Parameterization happens with... Fixed values
    19. Parameterization happens with... Statistically generated values Fixed values
    20. Parameterization happens with... Statistically generated values Fixed values Scripted values
    21. A simple example
    22. A really simple JTR runner... package jtr.test.fosdem; import jtr.runners.AbstractRunner; import junit.framework.Assert; public class FosdemRunner extends AbstractRunner { @Override public void test() throws Throwable { Assert.assertEquals(1978, hardcodedParameter); addMessage(\"Hardcoded parameter is: \"+hardcodedParameter); addMessage(\"\\nGaussian parameter is: \"+gaussianParameter); Assert.assertEquals(\"Hello FOSDEM\", scriptedParameter); addMessage(\"\\nScripted parameter is: \"+scriptedParameter); } private int hardcodedParameter; private double gaussianParameter; private String scriptedParameter; }
    23. A really simple JTR runner... package jtr.test.fosdem; Inherit useful behaviors import jtr.runners.AbstractRunner; import junit.framework.Assert; public class FosdemRunner extends AbstractRunner { @Override public void test() throws Throwable { Assert.assertEquals(1978, hardcodedParameter); addMessage(\"Hardcoded parameter is: \"+hardcodedParameter); addMessage(\"\\nGaussian parameter is: \"+gaussianParameter); Assert.assertEquals(\"Hello FOSDEM\", scriptedParameter); addMessage(\"\\nScripted parameter is: \"+scriptedParameter); } private int hardcodedParameter; private double gaussianParameter; private String scriptedParameter; }
    24. A really simple JTR runner... package jtr.test.fosdem; Your testing logic import jtr.runners.AbstractRunner; starts from here import junit.framework.Assert; public class FosdemRunner extends AbstractRunner { @Override public void test() throws Throwable { Assert.assertEquals(1978, hardcodedParameter); addMessage(\"Hardcoded parameter is: \"+hardcodedParameter); addMessage(\"\\nGaussian parameter is: \"+gaussianParameter); Assert.assertEquals(\"Hello FOSDEM\", scriptedParameter); addMessage(\"\\nScripted parameter is: \"+scriptedParameter); } private int hardcodedParameter; private double gaussianParameter; private String scriptedParameter; }
    25. A really simple JTR runner... package jtr.test.fosdem; Leverage on JUnit assertion import jtr.runners.AbstractRunner; APIs import junit.framework.Assert; public class FosdemRunner extends AbstractRunner { @Override public void test() throws Throwable { Assert.assertEquals(1978, hardcodedParameter); addMessage(\"Hardcoded parameter is: \"+hardcodedParameter); addMessage(\"\\nGaussian parameter is: \"+gaussianParameter); Assert.assertEquals(\"Hello FOSDEM\", scriptedParameter); addMessage(\"\\nScripted parameter is: \"+scriptedParameter); } private int hardcodedParameter; private double gaussianParameter; private String scriptedParameter; }
    26. A really simple JTR runner... package jtr.test.fosdem; import jtr.runners.AbstractRunner; import junit.framework.Assert; public class FosdemRunner extends AbstractRunner { Give end-users a feed-back @Override public void test() throws Throwable { for later inspection Assert.assertEquals(1978, hardcodedParameter); addMessage(\"Hardcoded parameter is: \"+hardcodedParameter); addMessage(\"\\nGaussian parameter is: \"+gaussianParameter); Assert.assertEquals(\"Hello FOSDEM\", scriptedParameter); addMessage(\"\\nScripted parameter is: \"+scriptedParameter); } private int hardcodedParameter; private double gaussianParameter; private String scriptedParameter; }
    27. A really simple JTR runner... package jtr.test.fosdem; import jtr.runners.AbstractRunner; import junit.framework.Assert; public class FosdemRunner extends AbstractRunner { @Override public void test() throws Throwable { Instance properties... any Assert.assertEquals(1978, hardcodedParameter); addMessage(\"Hardcoded parameter is: \"+hardcodedParameter); mutator method is required! addMessage(\"\\nGaussian parameter is: \"+gaussianParameter); Assert.assertEquals(\"Hello FOSDEM\", scriptedParameter); addMessage(\"\\nScripted parameter is: \"+scriptedParameter); } private int hardcodedParameter; private double gaussianParameter; private String scriptedParameter; }
    28. ... and its jtr.xml <runner runs=\"20\"> <runner-fqn>jtr.test.fosdem.FosdemRunner</runner-fqn> <instance-count>5</instance-count> <parameters-assignment-policy>indexed </parameters-assignment-policy> <parameters> <param name=\"sleepTime\" value=\"10\" /> <param name=\"hardcodedParameter\" value=\"1978\"/> <param name=\"gaussianParameter\" type=\"statistical\" value=\"Gaussian(5,0.3,8)\"/> <param name=\"scriptedParameter\" type=\"scripted\" value=\"helloFOSDEM\"/> </parameters> </runner> <scripts> <p-scripts> <p-script name=\"helloFOSDEM\" body=\"return &quot;Hello FOSDEM&quot;;\"/> </p-scripts> </scripts>
    29. ... and its jtr.xml how many times to run <runner runs=\"20\"> <runner-fqn>jtr.test.fosdem.FosdemRunner</runner-fqn> <instance-count>5</instance-count> <parameters-assignment-policy>indexed </parameters-assignment-policy> <parameters> <param name=\"sleepTime\" value=\"10\" /> <param name=\"hardcodedParameter\" value=\"1978\"/> <param name=\"gaussianParameter\" type=\"statistical\" value=\"Gaussian(5,0.3,8)\"/> <param name=\"scriptedParameter\" type=\"scripted\" value=\"helloFOSDEM\"/> </parameters> </runner> <scripts> <p-scripts> <p-script name=\"helloFOSDEM\" body=\"return &quot;Hello FOSDEM&quot;;\"/> </p-scripts> </scripts>
    30. ... and its jtr.xml the runner that has to run <runner runs=\"20\"> <runner-fqn>jtr.test.fosdem.FosdemRunner</runner-fqn> <instance-count>5</instance-count> <parameters-assignment-policy>indexed </parameters-assignment-policy> <parameters> <param name=\"sleepTime\" value=\"10\" /> <param name=\"hardcodedParameter\" value=\"1978\"/> <param name=\"gaussianParameter\" type=\"statistical\" value=\"Gaussian(5,0.3,8)\"/> <param name=\"scriptedParameter\" type=\"scripted\" value=\"helloFOSDEM\"/> </parameters> </runner> <scripts> <p-scripts> <p-script name=\"helloFOSDEM\" body=\"return &quot;Hello FOSDEM&quot;;\"/> </p-scripts> </scripts>
    31. ... and its jtr.xml how many instances? <runner runs=\"20\"> <runner-fqn>jtr.test.fosdem.FosdemRunner</runner-fqn> <instance-count>5</instance-count> <parameters-assignment-policy>indexed </parameters-assignment-policy> <parameters> <param name=\"sleepTime\" value=\"10\" /> <param name=\"hardcodedParameter\" value=\"1978\"/> <param name=\"gaussianParameter\" type=\"statistical\" value=\"Gaussian(5,0.3,8)\"/> <param name=\"scriptedParameter\" type=\"scripted\" value=\"helloFOSDEM\"/> </parameters> </runner> <scripts> <p-scripts> <p-script name=\"helloFOSDEM\" body=\"return &quot;Hello FOSDEM&quot;;\"/> </p-scripts> </scripts>
    32. ... and its jtr.xml <runner runs=\"20\"> <runner-fqn>jtr.test.fosdem.FosdemRunner</runner-fqn> a fixed input value <instance-count>5</instance-count> <parameters-assignment-policy>indexed </parameters-assignment-policy> <parameters> <param name=\"sleepTime\" value=\"10\" /> <param name=\"hardcodedParameter\" value=\"1978\"/> <param name=\"gaussianParameter\" type=\"statistical\" value=\"Gaussian(5,0.3,8)\"/> <param name=\"scriptedParameter\" type=\"scripted\" value=\"helloFOSDEM\"/> </parameters> </runner> <scripts> <p-scripts> <p-script name=\"helloFOSDEM\" body=\"return &quot;Hello FOSDEM&quot;;\"/> </p-scripts> </scripts>
    33. ... and its jtr.xml <runner runs=\"20\"> <runner-fqn>jtr.test.fosdem.FosdemRunner</runner-fqn> <instance-count>5</instance-count> a statistical one... <parameters-assignment-policy>indexed </parameters-assignment-policy> <parameters> <param name=\"sleepTime\" value=\"10\" /> <param name=\"hardcodedParameter\" value=\"1978\"/> <param name=\"gaussianParameter\" type=\"statistical\" value=\"Gaussian(5,0.3,8)\"/> <param name=\"scriptedParameter\" type=\"scripted\" value=\"helloFOSDEM\"/> </parameters> </runner> <scripts> <p-scripts> <p-script name=\"helloFOSDEM\" body=\"return &quot;Hello FOSDEM&quot;;\"/> </p-scripts> </scripts>
    34. ... and its jtr.xml <runner runs=\"20\"> <runner-fqn>jtr.test.fosdem.FosdemRunner</runner-fqn> <instance-count>5</instance-count> <parameters-assignment-policy>indexed </parameters-assignment-policy> ... and a scripted one <parameters> <param name=\"sleepTime\" value=\"10\" /> <param name=\"hardcodedParameter\" value=\"1978\"/> <param name=\"gaussianParameter\" type=\"statistical\" value=\"Gaussian(5,0.3,8)\"/> <param name=\"scriptedParameter\" type=\"scripted\" value=\"helloFOSDEM\"/> </parameters> </runner> <scripts> <p-scripts> <p-script name=\"helloFOSDEM\" body=\"return &quot;Hello FOSDEM&quot;;\"/> </p-scripts> </scripts>
    35. ... and its jtr.xml <runner runs=\"20\"> <runner-fqn>jtr.test.fosdem.FosdemRunner</runner-fqn> <instance-count>5</instance-count> <parameters-assignment-policy>indexed </parameters-assignment-policy> <parameters> <param name=\"sleepTime\" value=\"10\" /> <param name=\"hardcodedParameter\" value=\"1978\"/> <param name=\"gaussianParameter\" type=\"statistical\" value=\"Gaussian(5,0.3,8)\"/> <param name=\"scriptedParameter\" type=\"scripted\" value=\"helloFOSDEM\"/> </parameters> </runner> and here is the script <scripts> <p-scripts> <p-script name=\"helloFOSDEM\" body=\"return &quot;Hello FOSDEM&quot;;\"/> </p-scripts> </scripts>
    36. Let's run it! Let's run it!
    37. Write once, run many and anywhere
    38. Write once, run many and anywhere Declarative concurrent test execution
    39. Write once, run many and anywhere Declarative Declarative concurrent test distributed test execution execution
    40. Declarative distribution Simply add the following snippet to the jtr.xml file: <nodes> <node host=\"freddie\" port=\"2000\"/> <node host=\"barnie\" port=\"2001\"/> <node host=\"alice\" port=\"2002\"/> </nodes> For further details, please check the on-line users' guide.
    41. Some definitions • JTR Active Node runs the JTR runtime, our Runners and 3rd party libraries • JTR Passive Node only runs the JTR runtime
    42. JTR Distributed Testing at work Step one is the distribution of the jtr.xml configuration JTR active node JTR passive node runners and 3rd party only the JTR runtime libraries
    43. JTR Distributed Testing at work Missing class/resource request class/resource response JTR active node JTR passive node runners and 3rd party only the JTR runtime libraries
    44. Let's run it! Let'srun it again!
    45. Thus no manual deployments over passive-nodes
    46. Firewalls?! Not a problem
    47. What if I'm a JUnit fan?
    48. JTR 5 smoothly integrates JUnit 4
    49. and much more • Ant integration • headless testing • basic reporting (Excel exporting)
    50. Time is over... Salvador Dalí. (Spanish, 1904-1989). The Persistence of Memory. 1931. Oil on canvas, 9 1/2 x 13\" (24.1 x 33 cm). Given anonymously. © 2009 Salvador Dalí, Gala-Salvador Dalí Foundation/Artists Rights Society (ARS), New York
    51. THANK YOU! more on the website! http://jtrunner.sourceforge.net Francesco Russo frusso@users.sourceforge.net

    + fruxofruxo, 8 months ago

    custom

    313 views, 2 favs, 1 embeds more stats

    This presentation introduces to the main features o more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 313
      • 310 on SlideShare
      • 3 from embeds
    • Comments 0
    • Favorites 2
    • Downloads 0
    Most viewed embeds
    • 3 views on http://francescorusso.blogspot.com

    more

    All embeds
    • 3 views on http://francescorusso.blogspot.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories