
org.xwiki.rendering.test.integration.junit5.RenderingTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xwiki-rendering-test Show documentation
Show all versions of xwiki-rendering-test Show documentation
XWiki Rendering - Test Framework
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.xwiki.rendering.test.integration.junit5;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Stream;
import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.TestFactory;
import org.junit.jupiter.api.function.ThrowingConsumer;
import org.xwiki.rendering.test.integration.AbstractRenderingTest;
import org.xwiki.rendering.test.integration.Scope;
import org.xwiki.rendering.test.integration.TestDataGenerator;
/**
* Run all tests found in {@code *.test} files located in the classpath. These {@code *.test} files must follow the
* conventions described in {@link org.xwiki.rendering.test.integration.TestDataParser}.
* Usage Example
*
* @AllComponents
* class MyIntegrationTests extends RenderingTest
* {
* }
*
* It's also possible to get access to the underlying Component Manager used, for example in order to register
* Mock implementations of components. For example:
*
* @AllComponents
* class MyIntegrationTests extends RenderingTest
* {
* @Initialized
* public void initialize(MockitoComponentManager componentManager)
* {
* // Init mocks here for example
* }
* }
*
*
* @version $Id: 0db8cb0d77dd001cb8a49eb7154d32e43d264d16 $
* @since 13.0
*/
public class RenderingTest extends AbstractRenderingTest
{
/**
* @return the dynamic list of tests to execute
*/
@TestFactory
Stream renderingTests()
{
// Step 1: Generate inputs
// If a Scope Annotation is present then use it to define the scope
Scope scopeAnnotation = getClass().getAnnotation(Scope.class);
String packagePrefix = "";
String pattern = Scope.DEFAULT_PATTERN;
if (scopeAnnotation != null) {
packagePrefix = scopeAnnotation.value();
pattern = scopeAnnotation.pattern();
}
TestDataGenerator generator = new TestDataGenerator();
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy