Changes for page Testing
Last modified by Pascal Robert on 2012/01/03 10:53
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,36 +1,29 @@ 1 - ==Approaches to Testing==1 +I have checked in changes to the ant build files. The result of these is: 2 2 3 - Thereare differentkindsoftestsanddifferentapproachestotesting. No one technologyorapproachwillwork for everyone. These are some of the relevant technologies andissues in testing WebObjectsandWOnder applications and frameworks.3 +1) If you do a build as you used to do a build, there should be no change. 4 4 5 - "Frameworktesting" is testing that is oriented to testing the WebObjects frameworks or the WOnder frameworks themselves. "Application testing" is testing of an application or applications that are built using WebObjects or WOnder frameworks.Thereis obviously some overlap here.If one has an application, butwith Wonder,one is obviously using andtherefore implicitly testing both the WebObjectsand WOnderframeworks. "Framework testing" isexplicitly testingjust the framework functionalityin as general a way as possible. There aretests which seemtostraddle these two. But one can look at the intent. For example, two of the applications in Project WOnder are the "AjaxExample" and "BugTracker." The AjaxExample application is just a list of pages showing things that can be done. Nobody would construct an app like this for real work. On the other hand, the BugTracker app was created to be used by real people for tracking real bugs. It also demonstrates and provides a test for advanced features in WebObjects and WOnder. An application like AjaxExample can be easily changed so that it is easy to test. BugTracker cannot be so easily changed. On the other hand, BugTracker is more like a real-world application and so wecare about it a bit more than a demonstration project. It may end up being less convenient to test BugTracker, but it may be more important to test it.5 +2) There are two targets at the top-level: 6 6 7 - There may alsobe a distinctionbetween API tests, functional tests andperforancetests. Infunctional testing, one looks at some interface to an application and tests it to see if it does what it does. For example, if onelaunchestheBugTracker app andclicks things and checks what they do, that is functional testing.If one looksatthe API of aclass, such as theer.extensions.foundation.ERXThreadStorageclass, anddetermines what methods can be called on it and calls them, that is API testing. One canusually do API testing from a command-line interface andjunit is probably the tool ofchoiceforthis. Functional testing is not so simple. One can manually exercise an app,which may be called the "clicks and eyeballs" approach. This workswell,but does not scale. It becomes dull,people missthings, andwedo not haverobotsto do it for us. One can use a test runner to interactwitha running WebObjects/WOnder application. Performance testing often looks like functional testing, but the focus isdifferent.Itis not on seeing if thingswork, buthow fastthey work. In performance testing, one may have tousemeasurement tools which are not resistant to errors.In other words, performance testing may only work when everything else has been tested. One can do performance and functional testing at the same time, but perhaps one should not.7 + test-all - does a clean and then build of frameworks,applications, and examples with Dinclude.tests=true. 8 8 9 - ==Tools==9 + test-run - calls a junit test on selected projects 10 10 11 - Here are somerelevanttools.Itmaybe useful tosearchfor theirnames inthiswiki.11 +3) If the "test-all" target is invoked, then, in addition to any test sources being built in the other projects, the Wonder/Tests/ERXTest project is built. Is anyone involved in that project? If not, no harm, no foul. 12 12 13 -* Junit - for API testing 14 -* Selenium - for functional and some API testing 15 -* WOUnitTest - for functional testing (Is WOUnitTest current and being maintained? rrk) 16 -* JMeter - for performance testing 13 +4) I added a little stub of a test to ERExtensions. It does nothing right now. 17 17 18 - Questionsstillto beansweredincludethedifferentapproachesone musttake todifferent kinds of applications. Forexample,testinga"regular" WOnderapp may be differentthan testing a"DirectToWeb" app, which is alsodifferentthan testinga Java Client or a "Web Services" application. Different application types make some things easier andsomethings harder. One may need different approaches or different tools.Also, onemay be deploying an app as a regular java application,or asa servletin a J2EE container (e.g. Tomcat) or theapplicationmay be managed insome other way. How an application isdeployedmay change how it needs tobe tested.15 +5) I added a top-level target for "build" in Wonder/build.xml, just because it should be there. 19 19 20 - == DocumentReview==17 +Various things are needed to enable testing in a project: 21 21 22 -There aremanydocuments relevant to testingthat shouldbe evaluatedforveracity,usefulnessandrelevance:19 +1) There must be a "Tests" directory in the top level of the project. So chill has spoken and thus it shall be done. Put junit test java sources under that. 23 23 24 -* [[Project WONDER-Frameworks-ERSelenium>>WO:Project WONDER-Frameworks-ERSelenium]] 25 -* [[Selenium Introduction]] 26 -* [[Web Services-Testing Services with Terminal>>WO:Web Services-Testing Services with Terminal]] 27 -* [[Web Applications-Development-Testing and JUnit>>WO:Web Applications-Development-Testing and JUnit]] 28 -* [[How to Develop Selenium Tests]] 29 -* [[Testing-Load Testing WO Apps with JMeter>>WO:Testing-Load Testing WO Apps with JMeter]] 30 -* [[Testing-JUnit>>WO:Testing-JUnit]] 31 -* [[Testing-WOUnitTest>>WO:Testing-WOUnitTest]] 32 -* [[How to test a Diva app with Selenium>>WO:How to test a Diva app with Selenium]] 33 -* [[Web Services-Testing Services with TerminalWO:Web Services-Testing Services with Terminal]] 34 -* [[Specifying Robust Selenium Element Locators]] 35 -* [[Web Applications-Development-Testing and JUnit>>WO:Web Applications-Development-Testing and JUnit]] 36 -* [[Project WOnder Frameworks JUnit Testing]] 21 +2) There must be a parameter which defines the main test class. This could be a TestSuite, which would then invoke all the tests in the project. For example, the "ERChronic.all" target in the Build/build/build.xml file now includes the line: 22 + 23 + <param name="test.className" value="er.chronic.ChronicTestSuite" /> 24 + 25 +If there is no Tests directory in a project or if there are no sources in the Tests directory, then a build for testing does nothing more than a normal build. 26 + 27 +If there is no test.className property set in a project's target, then a build for testing does nothing more than a normal build. 28 + 29 +If there is no test.className property or there are no test classes in the jar files in the build root, then no tests from that project will be run. An example of a "test-run" appears below.