Testing
There are several types of tests:Unit Testing
- These are tests performed in isolation using Mock Objects. More specifically we're using JMock in XWiki.
- These tests must not interact with the environment (Database, Container, File System, etc) and do not need any setup to execute
- Unit tests for XWiki Core are located in http://fisheye2.cenqua.com/browse/xwiki/xwiki-platform/core/trunk/xwiki-core/src/test.
- Name the Test class with the name of the class under test suffixed with "Test". For example the JUnit test class for XWikiMessageTool should be named XWikiMessageToolTest
- Name the test methods with the method to test followed by a qualifier describing the test. For example testImportWithHeterogeneousEncodings().
Functional Testing
- These are tests done from a running XWiki instance.
- We are using Selenium RC to perform functional tests for GUI. We have created some JUnit extension to easily write Selenium tests in Java.
- Existing tests can be found in trunks/xwiki-product-enterprise/distribution-test/selenium-tests/
- We are using JUnit to perform functional tests for XMLRPC code. We have a JUnit extension framework for that too.
- Existing tests can be found in trunks/xwiki-product-enterprise/distribution-test/xmlrpc-tests/
- To run these tests on your local machine go to trunks-devs/ and type mvn install -Pxe,ci. This will build XWiki Enterprise and it's dependencies and run the tests on that (-Pci is needed since the tests are enabled by default only on the CI machine). Also check the Building page for more details.
- If you only want to execute the tests on an already built XWiki Core, simply go in trunks/xwiki-product-enterprise/distribution-test/ and type mvn install
- To run a specific test, pass the pattern property as in: mvn install -Dpattern=DeletePageTest (this will run the DeletePageTest - Note that you don't have to specify the extension). In addition if you wish to execute only a specific method from a Test Case class, you can pass the patternMethod property as in: mvn install -Dpattern=DeletePageTest -DpatternMethod=testDeletePageCanDoRedirect.
- To enable debug output from the selenium server start maven with the -Ddebug=true switch and then all messages from the selenium server are saved to: distribution-test/selenium-tests/target/selenium/server.log.
- To debug a functional Selenium test in your favourite Java IDE go in distribution-test/selenium-tests, edit the pom.xml to replace <background>true</background> with <background>false</background>, run mvn install, start the XWiki product version you wish to test, go in your IDE, find the test you wish to run, put breakpoints and run it in debug mode. Not only will you get the Java debugging power but you can also see the browser in action, check the rendered page in the browser (using for Firebug example), etc.
Performance Testing
- These are memory leakage tests, load tests and speed of execution tests.
- They are performed manually and in an ad hoc fashion for now.
Version 2.1 last modified by VincentMassol on 01/06/2008 at 15:49
Document data
Attachments:
No attachments for this document
Comments: 0