org.apache.struts2.testng

## Class StrutsTestCase

- java.lang.Object
- - org.apache.struts2.testng.TestNGXWorkTestCase
  - - org.apache.struts2.testng.StrutsTestCase

-     public class StrutsTestCase
      extends TestNGXWorkTestCase

  Base test class for TestNG unit tests. Provides common Struts variables and performs Struts setup and teardown processes

- - ### Field Summary

    - ### Fields inherited from class org.apache.struts2.testng.TestNGXWorkTestCase

      `actionProxyFactory, configuration, configurationManager, container`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StrutsTestCase()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected <T> T` | `createAction(Class<T> clazz)` A helper method which allows instantiate an action if this action extends `ActionSupport` or any other action class that requires framework's dependencies injection.
    `protected Dispatcher` | `initDispatcher(Map<String,String> params)`
    `protected void` | `setUp()`
    `protected void` | `tearDown()`

    - ### Methods inherited from class org.apache.struts2.testng.TestNGXWorkTestCase

      `loadConfigurationProviders`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### StrutsTestCase

          public StrutsTestCase()

  - ### Method Detail

    - #### setUp

          @BeforeTest
          protected void setUp()
                                    throws Exception

      Overrides:
        `setUp` in class `TestNGXWorkTestCase`
      Throws:
        `Exception`

    - #### initDispatcher

          protected Dispatcher initDispatcher(Map<String,String> params)

    - #### createAction

          protected <T> T createAction(Class<T> clazz)

      A helper method which allows instantiate an action if this action extends `ActionSupport` or any other action class that requires framework's dependencies injection.

    - #### tearDown

          @AfterTest
          protected void tearDown()
                                      throws Exception

      Overrides:
        `tearDown` in class `TestNGXWorkTestCase`
      Throws:
        `Exception`

Copyright © 2000–2026 Apache Software Foundation. All rights reserved.