title: How to make WELD ignore the SessionScope of a bean class when executing a test method in a test class
body: <p>i have the test method below:</p>
  <pre><code>@Test(
    enabled = ConfigTest.ENABLED_EAGER_USRINFOTEST,
    testName = &quot;test_usr_access_by_master&quot;,
    invocationCount = 1,
    threadPoolSize = 1,
    description = &quot;testing master user access roles&quot;,
    successPercentage = 100,
    priority = 10)
  public void testUsrAccessByMaster() throws Exception {
    JndiDbSetup.setUpDataSources();
    SeContainerInitializer initializer = SeContainerInitializer.newInstance();
    try (SeContainer container = initializer
      .disableDiscovery()
      .addBeanClasses(
        mypackage.GrupoBean.class,
        mypackage.OrgaoGrupoBean.class,
        mypackage.MockProfileCadmatMasterProvider.class, // Injeção do CPF
        mypackage.UsrAccessBean.class,
        EMFProvider.class)
      .initialize()) {
                  
      AdmData.load(); // create and load database for the test
                  
      Dao&lt;Grupo&gt; daoGrupo = container.select(GrupoBean.class, new Qualifier.DaoGrupo()).get();
      assert daoGrupo != null : &quot;precondition failed: dao Grupo null&quot;;
                  
      ...
                  
    }
  }
  </code></pre>
  <p>my bean classes (GrupoBean, OrgaoGrupoBean) are configured like this:</p>
  <pre><code>@Dependent @Default @DaoType(value = TipoClasse.GRUPO)
  public class GrupoBean extends AbsDao&lt;Grupo&gt; implements Dao&lt;Grupo&gt;, Serializable { ... }
  
  @Dependent @Default @DaoType(value = TipoClasse.ORGAO_GRUPO)
  public class OrgaoGrupoBean extends AbsDao&lt;OrgaoGrupo&gt; implements Dao&lt;OrgaoGrupo&gt;, Serializable { ... }
  </code></pre>
  <p>and my UsrAccessBean is configured like this:</p>
  <pre><code>@SessionScoped
  public class UsrAccessBean implements UsrAccess, Serializable { ... }
  </code></pre>
  <p>when i run my test class, I get the following error message from WELD:</p>
  <pre><code>2022-01-24 11:30:08 [main] INFO  org.jboss.weld.Bootstrap - WELD-ENV-002001: Weld SE container 1ea20aa1-220b-400e-8fe4-a3103ab8fc14 shut down
  Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.562 s &lt;&lt;&lt; FAILURE! - in mypackage.UsrInfoMasterTest
  mypackage.UsrInfoMasterTest.testUsrAccessByMaster  Time elapsed: 1.266 s  &lt;&lt;&lt; FAILURE!
  org.jboss.weld.exceptions.WeldException: WELD-000049: Unable to invoke public void mypackage.GrupoBean.init() on mypackage.GrupoBean@47b67fcb at mypackage.UsrInfoMasterTest.testUsrAccessByMaster(UsrInfoMasterTest.java:49)
  Caused by: java.lang.reflect.InvocationTargetException at mypackage.UsrInfoMasterTest.testUsrAccessByMaster(UsrInfoMasterTest.java:49)
  Caused by: org.jboss.weld.contexts.ContextNotActiveException: WELD-001303: No active contexts for scope type javax.enterprise.context.SessionScoped at mypackage.UsrInfoMasterTest.testUsrAccessByMaster(UsrInfoMasterTest.java:49)
  </code></pre>
  <p>I can't change the SessionScope in the UsrAccessBean class because it contains the logged user information, and I use this information to validate the user's actions while navigating the system</p>
  <p>I need to make the weld ignore the scope of these beans when executing the test methods, I'm noob at weld and I have no idea how to do this, can anyone help me?</p>