AntUnit Your Functional Test Jimmy Zhao  Dec 30, 2008
 
About Me <ul><li>From China </li></ul><ul><li>More than 8 years of project experience with Ant </li></ul><ul><li>6 years o...
What? <ul><li>Ant & AntUnit </li></ul><ul><li>For people </li></ul><ul><ul><li>Agile developers </li></ul></ul><ul><ul><li...
Agenda <ul><li>Why AntUnit?  </li></ul><ul><li>How to use & extend   it? </li></ul><ul><li>My simple  AntUnit extension s ...
Pain of Agile Developers
<ul><li>test  ==  workload </li></ul><ul><li>test  ==  boring </li></ul><ul><li>test  ==  low value </li></ul><ul><li>test...
A Silver Bullet For Testing <ul><li>Ant  </li></ul><ul><ul><li>Cover almost every corners of development </li></ul></ul><u...
Official Definition <ul><li>AntUnit  provides Ant tasks  for   testing Ant task , it can also be used to  drive  functiona...
Why AntUnit? Most flexible way to assert your functions Great extendibility  So many tasks ready for use Perfectly integra...
Call Me  “Eleph ant ” Picture from:  deviantart.com   Paradox__Ant_and_Elephant_by_Darkberry_Fruity.jpg
The Simplest Continuous Integration & Test Solution Ant task too, but we call it  assertion  here All of them are  Ant Tas...
Two Ways of Using AntUnit <ul><li>A: Ant as a drive </li></ul><ul><ul><li>Define your test scenario by  </li></ul></ul><ul...
Why Extend AntUnit? <ul><li>Assert a function is complicated  </li></ul><ul><ul><li>Business logic </li></ul></ul><ul><ul>...
Before Extend AntUnit <ul><li>Just like A normal ant tasks </li></ul><ul><li>Something your should know  </li></ul><ul><ul...
Example 1 <ul><li><project name=&quot;echo-test&quot; basedir=&quot;.&quot; default=&quot;all&quot; </li></ul><ul><li>xmln...
Examples <ul><li>Command Line application </li></ul><ul><ul><li>Normal Ant t asks  + AntUnit </li></ul></ul><ul><ul><ul><l...
My AntUnit Extensions <ul><li>Extension 1 </li></ul><ul><ul><li>Better functional test purpose assertions </li></ul></ul><...
CLI Example <ul><li><target name=&quot;test CLIApp &quot;> </li></ul><ul><li><exec executable=&quot;cmd&quot;>  </li></ul>...
Web Application Example <ul><li><target name=&quot;testSeleniumTask&quot;> </li></ul><ul><li>< selenium > </li></ul><ul><l...
More Test Purposed Extensions <ul><li>Listener as task </li></ul><ul><ul><li>For monitoring the testing progress </li></ul...
Problems/Found Issues <ul><li>Setup/TearDown for each test </li></ul><ul><ul><li>It’s good but sometimes also a problem </...
Similar Ideas <ul><li>Webtest project of Canoo </li></ul><ul><ul><li>Selenium readable Ant script </li></ul></ul><ul><li>C...
Resources <ul><li>Webtest of Canoo </li></ul><ul><li>CruiseControl & Plugins </li></ul><ul><li>Selenium & projects in Open...
 
Upcoming SlideShare
Loading in …5
×

Ant Unit Your Functional Test

3,043 views

Published on

Ant & AntUnit
For people:
Agile developers
People largely involves in testing?
Looking for a solution for build & testing
Loose coupling
Complex application environment

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,043
On SlideShare
0
From Embeds
0
Number of Embeds
27
Actions
Shares
0
Downloads
42
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • Ant Unit Your Functional Test

    1. 1. AntUnit Your Functional Test Jimmy Zhao Dec 30, 2008
    2. 3. About Me <ul><li>From China </li></ul><ul><li>More than 8 years of project experience with Ant </li></ul><ul><li>6 years of Agile experience </li></ul><ul><li>Developed a test engine just like Ant </li></ul>
    3. 4. What? <ul><li>Ant & AntUnit </li></ul><ul><li>For people </li></ul><ul><ul><li>Agile developers </li></ul></ul><ul><ul><li>People largely involves in testing? </li></ul></ul><ul><ul><li>Looking for a solution for build & testing </li></ul></ul><ul><ul><li>Loose coupling </li></ul></ul><ul><ul><li>Complex application environment </li></ul></ul>
    4. 5. Agenda <ul><li>Why AntUnit? </li></ul><ul><li>How to use & extend it? </li></ul><ul><li>My simple AntUnit extension s </li></ul><ul><li>Examples & Demo </li></ul><ul><li>More thoughts </li></ul><ul><li>Q & A </li></ul>
    5. 6. Pain of Agile Developers
    6. 7. <ul><li>test == workload </li></ul><ul><li>test == boring </li></ul><ul><li>test == low value </li></ul><ul><li>test == QA </li></ul><ul><li>test != developer </li></ul>Quality http://www.siafu.ca/files/smallANTEL_2.jpg Test ==  ?
    7. 8. A Silver Bullet For Testing <ul><li>Ant </li></ul><ul><ul><li>Cover almost every corners of development </li></ul></ul><ul><ul><li>Numerous Ant extensions ready </li></ul></ul><ul><li>AntUnit – just released 1.1 </li></ul><ul><ul><li>Test Ant Task </li></ul></ul><ul><ul><li>Everything is possible </li></ul></ul>
    8. 9. Official Definition <ul><li>AntUnit provides Ant tasks for testing Ant task , it can also be used to drive functional and integration tests of arbitrary applications with Ant. </li></ul>
    9. 10. Why AntUnit? Most flexible way to assert your functions Great extendibility So many tasks ready for use Perfectly integrate with development environment Controllable granularity
    10. 11. Call Me “Eleph ant ” Picture from: deviantart.com Paradox__Ant_and_Elephant_by_Darkberry_Fruity.jpg
    11. 12. The Simplest Continuous Integration & Test Solution Ant task too, but we call it assertion here All of them are Ant Tasks Everything Ant Build & Deploy Integration Test System Test AntUnit Test Report Notification Check Style Emma
    12. 13. Two Ways of Using AntUnit <ul><li>A: Ant as a drive </li></ul><ul><ul><li>Define your test scenario by </li></ul></ul><ul><ul><li>Integrate them in Ant </li></ul></ul><ul><li>B: Ant as script engine </li></ul><ul><ul><li>Define your test scenario in Ant script </li></ul></ul><ul><ul><li>Use Ant xml files to manage your cases </li></ul></ul><ul><li>Don’t forget to assert via AntUnit </li></ul><ul><ul><li>White-box testing </li></ul></ul>
    13. 14. Why Extend AntUnit? <ul><li>Assert a function is complicated </li></ul><ul><ul><li>Business logic </li></ul></ul><ul><ul><ul><li>i.e. web flow with session </li></ul></ul></ul><ul><ul><li>C orner cases of testing </li></ul></ul><ul><ul><ul><li>i.e. https authentication </li></ul></ul></ul><ul><li>Combine/reuse existing assertions </li></ul><ul><ul><li>Sequential multiple assertions </li></ul></ul><ul><ul><li>And/or/xor assertion result </li></ul></ul><ul><ul><li>Extend existing tasks </li></ul></ul>
    14. 15. Before Extend AntUnit <ul><li>Just like A normal ant tasks </li></ul><ul><li>Something your should know </li></ul><ul><ul><li>Condition and Fail </li></ul></ul><ul><ul><li>XML Namespace awareness </li></ul></ul><ul><ul><li>AntListener </li></ul></ul><ul><ul><li>Sequential </li></ul></ul><ul><ul><li>Macrodef & Scriptdef </li></ul></ul>
    15. 16. Example 1 <ul><li><project name=&quot;echo-test&quot; basedir=&quot;.&quot; default=&quot;all&quot; </li></ul><ul><li>xmlns:au=&quot;antlib:org.apache.ant.antunit&quot; > </li></ul><ul><li>< macrodef name=&quot;assertFalse&quot; backtrace=&quot;false&quot;> </li></ul><ul><li><attribute name=&quot;message&quot; default=&quot;Assertion failed&quot;/> </li></ul><ul><li><element name=&quot;assertion&quot; implicit=&quot;true&quot;/> </li></ul><ul><li><sequential> </li></ul><ul><li><au:assertTrue message=&quot;@{message}&quot;> </li></ul><ul><li><not> </li></ul><ul><li><assertion/> </li></ul><ul><li></not> </li></ul><ul><li></au:assertTrue> </li></ul><ul><li></sequential> </li></ul><ul><li></ macrodef > </li></ul><ul><li><target> </li></ul><ul><li></project> </li></ul>
    16. 17. Examples <ul><li>Command Line application </li></ul><ul><ul><li>Normal Ant t asks + AntUnit </li></ul></ul><ul><ul><ul><li>Sshexec/Exec/telnet + assertions </li></ul></ul></ul><ul><li>Web UI application </li></ul><ul><ul><li>JUnit extension tasks + AntUnit </li></ul></ul><ul><ul><ul><li>A: HttpUnit/Selenium + assertions </li></ul></ul></ul><ul><ul><ul><li>B: AntUnit + assertions based on Selenium </li></ul></ul></ul><ul><li>GUI application </li></ul><ul><ul><li>Junit extension tasks + AntUnit </li></ul></ul><ul><ul><ul><li>Abbot + AntUnit </li></ul></ul></ul>
    17. 18. My AntUnit Extensions <ul><li>Extension 1 </li></ul><ul><ul><li>Better functional test purpose assertions </li></ul></ul><ul><ul><ul><li>St d o utAssertion – LogContains Task </li></ul></ul></ul><ul><ul><ul><li>FileAssertion – ResourceContains Task </li></ul></ul></ul><ul><ul><ul><li>Log4jAssertion – no in 1.1 yet </li></ul></ul></ul><ul><li>Extension 2 </li></ul><ul><ul><li>Selenium junit extension based task </li></ul></ul><ul><li>Use all of them together </li></ul>
    18. 19. CLI Example <ul><li><target name=&quot;test CLIApp &quot;> </li></ul><ul><li><exec executable=&quot;cmd&quot;> </li></ul><ul><li><arg value=&quot;/c&quot;/> </li></ul><ul><li><arg value=&quot;ant.bat&quot;/> </li></ul><ul><li><arg value=&quot;-p&quot;/> </li></ul><ul><li></exec> </li></ul><ul><li><au:assert> </li></ul><ul><li></target> </li></ul>
    19. 20. Web Application Example <ul><li><target name=&quot;testSeleniumTask&quot;> </li></ul><ul><li>< selenium > </li></ul><ul><li>< sequential > </li></ul><ul><li>< command name=&quot;open&quot;>/</command> </li></ul><ul><li><command name=&quot;click&quot;>btnG</command> </li></ul><ul><li><command name=&quot;waitForPageToLoad&quot;> 5 000</command> </li></ul><ul><li><command name=&quot;click&quot;>//div[@id='res']/div[1]/ol/li[1]/h3/a/em</command> </li></ul><ul><li><command name=&quot;waitForPageToLoad&quot;> 5 000</command> </li></ul><ul><li></ sequential > </li></ul><ul><li></selenium> </li></ul><ul><li>< au:assertTrue > </li></ul><ul><li><command name=&quot;isTextPresent&quot;>AntUnit 1.1</command> </li></ul><ul><li></ au:assertTrue > </li></ul><ul><li></target> </li></ul>
    20. 21. More Test Purposed Extensions <ul><li>Listener as task </li></ul><ul><ul><li>For monitoring the testing progress </li></ul></ul><ul><li>Thread-liked/Recursive/Timing task </li></ul><ul><ul><li>Embedded runtime & dynamic task needed, i.e. logging </li></ul></ul><ul><li>Assertion Combination </li></ul><ul><ul><li>And/Or/Xor for assertion results </li></ul></ul>
    21. 22. Problems/Found Issues <ul><li>Setup/TearDown for each test </li></ul><ul><ul><li>It’s good but sometimes also a problem </li></ul></ul><ul><ul><ul><li>especially in a functional test environment </li></ul></ul></ul><ul><ul><ul><li>Should be configurable </li></ul></ul></ul><ul><li>Not really good at case management </li></ul><ul><ul><li>Case dependency is an issue </li></ul></ul><ul><ul><li>XML file + Target dependency </li></ul></ul><ul><ul><li>Too flexible is also a problem </li></ul></ul><ul><ul><ul><li>T est pattern needed </li></ul></ul></ul>
    22. 23. Similar Ideas <ul><li>Webtest project of Canoo </li></ul><ul><ul><li>Selenium readable Ant script </li></ul></ul><ul><li>CruiseControl & Plugins </li></ul>
    23. 24. Resources <ul><li>Webtest of Canoo </li></ul><ul><li>CruiseControl & Plugins </li></ul><ul><li>Selenium & projects in OpenQA </li></ul><ul><li>Abbot @ sourceforge </li></ul>

    ×