Changes for page Testing

Last modified by Simon Urli on 2019/06/27 11:25

From version 145.4
edited by Vincent Massol
on 2019/05/17 14:14
To version 146.1
edited by Vincent Massol
on 2019/05/21 09:36
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -142,6 +142,30 @@
142 142  * Tests must not depend on one another. In other words, it should be possible to execute tests in any order and running only one test class should work fine.
143 143  * Tests that need to change existing configuration (e.g. change the default language, set specific rights, etc) must put back the configuration as it was. This is true only in flavor tests or when several functional tests of different domains are executed one after another. However functional tests located in xwiki-platform specific modules are only running the tests for their module and thus it's not important, and saves times, if they don't clean up.
144 144  * Tests are allowed to create new documents and don't need to remove them at the end of the test.
145 +* Stdout/stderr validation errors(((
146 +We have a [[check>>Community.Building.WebHome||anchor="HAutomaticChecks"]] that verifies if functional tests output some invalid content to stdout/stderr. If your test contains such errors it'll fail and then you have 3 options:
147 +* It's a normal and expected output from the test (for ex the test verifies an error condition and it's expected it will raise a stack trace in the console). In this case add an expectation in the test. For example:(((
148 +{{code language='java'}}
149 +public class TemplateTest extends AbstractTest
150 +{
151 + public void wrongTemplate()
152 + {
153 + ...
154 + this.validateConsole.getLogCaptureConfiguration().registerExpected( "Possible break-in attempt!",
155 + "Error getting resource [null]");
156 + }
157 +...
158 +{{/code}}
159 +)))
160 +* It's a non-expected error. You then have 2 sub-choices:
161 +** Fix the problem (the best and recommended solution!)
162 +** Increase the technical debt by adding an exclude. For example:(((
163 +{{code language='java'}}
164 +this.validateConsole.getLogCaptureConfiguration().registerExcludes(
165 + "java.lang.IllegalStateException: Response is committed");
166 +{{/code}}
167 +)))
168 +)))
145 145  
146 146  Examples of functional tests:
147 147  

Get Connected