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,35 +1,69 @@ 1 - ==Approaches toTesting==1 +There are many documents relevant to testing that should be evaluated for veracity, usefulness and relevance: 2 2 3 -There are different kinds of tests and different approaches to testing. No one technology or approach will work for everyone. These are some of the relevant technologies and issues in testing WebObjects and WOnder applications and frameworks. 3 +* http:~/~/wiki.objectstyle.org/confluence/display/WO/Project+WONDER-Frameworks-ERSelenium 4 +* http:~/~/wiki.objectstyle.org/confluence/display/WONDER/Selenium+Introduction 5 +* http:~/~/wiki.objectstyle.org/confluence/display/WO/Web+Services-Testing+Services+with+Terminal 6 +* http:~/~/wiki.objectstyle.org/confluence/display/WO/Web+Applications-Development-Testing+and+JUnit 7 +* http:~/~/wiki.objectstyle.org/confluence/display/WONDER/How+to+Develop+Selenium+Tests 8 +* http:~/~/wiki.objectstyle.org/confluence/display/WO/Testing-Load+Testing+WO+Apps+with+JMeter 9 +* http:~/~/wiki.objectstyle.org/confluence/display/WO/Testing-JUnit 10 +* http:~/~/wiki.objectstyle.org/confluence/display/WO/Testing-WOUnitTest 4 4 5 - "Frameworktesting"istestingthat 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.There isobviously some overlap here. If one has an application, but with Wonder, one is obviously usingand therefore implicitly testing both the WebObjects and WOnderframeworks."Framework testing" is explicitly testing just the framework functionality in as general a way as possible. There are tests which seem to straddle these two. But one can look at the intent. For example, two of the applications inProject WOnder are the "AjaxExample" and "BugTracker." The AjaxExample applicationis just a list of pages showing things that can bedone. Nobody would constructan app like this for real work. Onthe 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.Anapplicationlike AjaxExample can be easily changed so that it is easy to test.BugTracker cannot be so easily changed. On the other hand, BugTracker ismore like a real-world application and so we care 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.12 +== Junit Testing of Project Wonder in Ant Builds == 6 6 7 - There may also be a distinction between APItests, functional tests and perforance tests. In functional testing, one looks at some interface to an application and tests it to see if it does what it does.For example, if one launches the BugTracker app andclicks thingsandchecks what they do, that is functional testing. If onelooksatthe APIofa class, such astheer.extensions.foundation.ERXThreadStorageclass, and determines what methods canbe 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 ofchoice for this. Functionaltesting is not so simple.One can manually exercise an app, which may be called the "clicks and eyeballs" approach.This works well,but does not scale. It becomes dull, people miss things, and we do not haverobots to do it for us. Onecan use a test runner to interact with a running WebObjects/WOnder application.Performance testing oftenlooks like functional testing, but thefocusis different.Itisnot on seeing if things work, but how fast they work. In performance testing, one may have to use measurement 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.14 +I have checked in changes to the ant build files. The result of these is: 8 8 9 -== Tools == 16 +1. 1) If you do a build as you used to do a build, there should be no change. 17 +1. 2) There are two targets at the top-level: 18 +1*. test-all - does a clean and then build of frameworks,applications, and examples with Dinclude.tests=true. 19 +1*. test-run - calls a junit test on selected proje 20 +1. 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. 21 +1. 4) I added a little stub of a test to ERExtensions. It does nothing right now. 22 +1. 5) I added a top-level target for "build" in Wonder/build.xml, just because it should be there. 10 10 11 - Hereare somerelevanttools.It may beusefultosearchfortheirnamesinthiswiki.24 +Various things are needed to enable testing in a project: 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 26 +1. 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. 27 +1. 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: 28 +1*. <param name="test.className" value="er.chronic.ChronicTestSuite" /> 17 17 18 - Questions stilltobeansweredincludethedifferentapproachesonemusttake todifferent kinds of applications. Forexample, testinga"regular" WOnderapp may be differentthan testinga "DirectToWeb"app, whichis alsodifferentthantestingaJava Clientor"WebServices" application.Differentapplication typesmakesome thingseasierandsomehingsharder.Onemayneeddifferentapproaches or differenttools.Also,onemaybe deployinganappasaregular javaapplication,oras a servletinaJ2EE container(e.g.Tomcat)ortheapplicationmay bemanagedinsome otherway.Howanapplicationisdeployedmaychangehowitneedstobetested.30 +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. 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. 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.\\ 19 19 20 - == Document Review ==32 +{{code}} 21 21 22 -There are many documents relevant to testing that should be evaluated for veracity, usefulness and relevance: 34 +% cd Wonder 35 +% ant tests.run 36 +Buildfile: build.xml 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 -* [[Specifying Robust Selenium Element Locators]] 34 -* [[Web Applications-Development-Testing and JUnit>>WO:Web Applications-Development-Testing and JUnit]] 35 -* [[Project WOnder Frameworks JUnit Testing]] 38 +tests.run: 39 + 40 +tests.run: 41 + 42 +ERExtensions.all: 43 + 44 +global.environment: 45 + 46 +global.properties: 47 + 48 +global.framework.test: 49 + [junit] Testsuite: er.extensions.statistics.ERXMetricsTest 50 + [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.002 sec 51 + [junit] 52 + 53 +ERChronic.all: 54 + 55 +global.environment: 56 + 57 +global.properties: 58 + 59 +global.framework.test: 60 + [junit] Testsuite: er.chronic.ChronicTestSuite 61 + [junit] Tests run: 74, Failures: 0, Errors: 0, Time elapsed: 0.355 sec 62 + [junit] 63 + 64 +BUILD SUCCESSFUL 65 +Total time: 0 seconds 66 + 67 +{{/code}} 68 + 69 +\\