<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->


<faqs xmlns="http://maven.apache.org/FML/1.0.1"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/FML/1.0.1 http://maven.apache.org/xsd/fml-1.0.1.xsd"
      id="FAQ" title="Frequently Asked Questions">
  <part id="General">
    <faq id="surefire-v-failsafe">
      <question>What is the difference between maven-failsafe-plugin and maven-surefire-plugin?</question>
      <answer>
        <p>
          <a href="http://maven.apache.org/plugins/maven-surefire-plugin">maven-surefire-plugin</a>
          is designed for running unit tests and if any of the tests fail then it will fail the build immediately.
        </p>
        <p>
          <a href="http://maven.apache.org/plugins/maven-failsafe-plugin">maven-failsafe-plugin</a>
          is designed for running integration tests, and decouples failing the build if there
          are test failures from actually running the tests.
        </p>
      </answer>
    </faq>
    <faq id="reuse-test-code">
      <question>How can I reuse my test code in other modules?</question>
      <answer>
        <p>
          Visit this link for your reference,
          <a href="http://maven.apache.org/guides/mini/guide-attached-tests.html">
         |   Attaching tests
          </a>
        </p>
      </answer>
    </faq>
    <faq id="vm-termination">
      <question>Surefire fails with the message "The forked VM terminated without properly saying  goodbye"</question>
      <answer>
        <p>
        Surefire does not support tests or any referenced libraries calling System.exit() at any time. If
        they do so, they are incompatible with surefire and you should probably file an issue with the library/vendor.

        Alternatively the forked VM could also crash for a number of reasons, which can also make this issue happen.
        Look for the classical "hs_err*" files indicating VM crashes or examine the log output from running maven
        when the tests execute. Some "extraordinary" output from crashing processes may be dumped to the console/log.

        If this happens on a CI environment and only after some time runs there is a fair chance your test suite is
        leaking some kind of OS-level resource that makes things worse for every run. Regular os-level monitoring tools
        may give you some indication.
        </p>
      </answer>
    </faq>
    <faq id="GWT">
      <question>How can I run GWT tests ?</question>
      <answer>
        There is a specific gwt-maven-plugin at codehaus, but if you want to run
        with surefire, you need the following settings:
        <p>
        Use the following configuration:<br/>
        <code>
        <![CDATA[ <useSystemClassLoader>true</useSystemClassLoader>]]><br/>
        <![CDATA[ <useManifestOnlyJar>false</useManifestOnlyJar>]]><br/>
        <![CDATA[ <forkCount>1</forkCount>]]><br/>
        </code>
        try reuseForks=true and if it doesn't work, fall back to reuseForks=false
        </p>
      </answer>
    </faq>
    <faq id="late-property-evaluation">
      <question>How do I use properties set by other plugins in argLine?</question>
      <answer>
        <p>
          Maven does property replacement for <pre>${...}</pre> values in pom.xml before any
          plugin is run. So surefire would never see the place-holders in its argLine property.
        </p>
        <p>
          Using an alternate syntax for these properties, <pre>@{...}</pre> allows late replacement
          of properties when the plugin is executed, so properties that have been modified by other
          plugins will be picked up correctly.
        </p>
      </answer>
    </faq>
  </part>
</faqs>
