Object-oriented unit test

Asked

Viewed 84 times

1

I’m trying to perform an object-oriented unit test, and the same is saying that the object was not instantiated.

Follows the code:

[DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML",
           "|DataDirectory|\\MassaDados\\MassaDados.xml",
           "GruposSubgrupos", DataAccessMethod.Sequential)]
[Timeout(TestTimeout.Infinite)]
[TestMethod]
[DeploymentItem(@"MassaDados")]
[DeploymentItem(@"ChefWeb\Data")]
public void TestMethod0250_GruposSubgrupos()
{
#if RELEASE
    try
    {
#endif
    browser = Util.Inicializa();
    Menu.NavegarAdmFranquia_GrupoSubgrupo(browser);
    Util.AguardarWaitPanel(browser);

    var searchTimeout = Playback.PlaybackSettings.SearchTimeout;
    Playback.PlaybackSettings.SearchTimeout = 4000;

    while (!BrowserWindow.Locate("Grupos e Subgrupo").Exists) ;
    {
        Playback.Wait(2000);
    }
    Playback.PlaybackSettings.SearchTimeout = searchTimeout;
    browser = BrowserWindow.Locate("Grupos e Subgrupo");
    Util.AguardarWaitPanel(browser);

    var loja = Util.RetornarLoja();
    var objTeste = new CadastroGrupoSubgrupo();
    var objTesteDados = objTeste.PreencherClasseGrupoSubGrupo(TestContext, loja);

    Validacao val = new Validacao();
    objTeste.GerenciarGrupoSubgrupo(browser, objTesteDados);
    if (!objTesteDados.VinculadoAProduto)
    {
        var DtConfigInicial = new DataTable();
        DtConfigInicial = Util.CarregarConfigInicial();
        if (DtConfigInicial.Rows[0]["Validar_BancoDados"] != DBNull.Value)
        {
            if (DtConfigInicial.Rows[0]["Validar_BancoDadoos"].ToString().ToUpper() == "SIM")
                val.ValidarBD(TestContext.DataRow, TestContext.DataRow.Table.TableName, objTesteDados.Operacao, false);
        }
    }
    Util.AtualizarStatusTFS(TestContext, "Sucesso");
    Util.NavegarUrlChefWeb(browser);


#if RELEASE
    }
    catch (Exception ex)
    {
        Util.AtualizarStatusTFS(TestContext, "Falha");
        Util.NavegarUrlChefWeb(browser);
        throw ex;
    }
#endif
    Playback.Wait(3000);
}
  • which object was not instantiated. ?

  • This is all a unitary test?

  • A #if RELEASE for unit testing?

  • Marconcilio souza, visula studio does not say which object was not found, ai estou bem perdido.

  • extension, it is object-oriented unitary

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.