Error message on using CUITe_DataManager

Oct 10, 2013 at 4:27 PM
Hi,

I keep getting the following error message on trying to use the CUITe Data manger to read values off an xml.

Failed to get resource 'DTAF_Draft.Tests.TestData.Test.xml' from type 'DTAF_Draft.Tests.Modules.D3_POC' and assembly 'DTAF_Draft, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

Hashtable htData = CUITe.CUITe_DataManager.GetDataRow(Type.GetType("DTAF_Draft.Tests.Modules.D3_POC", true, true), "DTAF_Draft.Tests.TestData.Test.xml", "tc02");

I do feel that I may have messed up the string path to the files in the above code. Please refer to the attched screenshot. --> https://www.dropbox.com/sh/d19pbwr4a3ps9rz/ENxyrV9mFS

Any help is highly appreciated.

Image
Oct 10, 2013 at 6:53 PM
Found the solution after spending couple of hours debugging through te source code.

Problem lies in the CUITe_DataManager.cs file in Source_Code for the CUITe framework

The below function needs to be updated.

Current function
  private static XmlTextReader GetXmlTextReader(Assembly assembly, Type type, string fileName)
    {

        Stream stream = assembly.GetManifestResourceStream(type, fileName);
        if (stream == null)
        {
            throw new ResourceNotFoundException(assembly.FullName, type.ToString(), fileName);
        }

        return new XmlTextReader(stream);
    }

Updated function
  private static XmlTextReader GetXmlTextReader(Assembly assembly, Type type, string fileName)
    {

        Stream stream = assembly.GetManifestResourceStream(fileName); --> Remove the type parameter from this function
        if (stream == null)
        {
            throw new ResourceNotFoundException(assembly.FullName, type.ToString(), fileName);
        }

        return new XmlTextReader(stream);
    }
Coordinator
Oct 11, 2013 at 8:37 AM
Hi saxenaankit123,

I think the problem is the way you create your type.

For example, instead of this:
Hashtable htData = CUITe.CUITe_DataManager.GetDataRow(Type.GetType("DTAF_Draft.Tests.Modules.D3_POC", true, true), "DTAF_Draft.Tests.TestData.Test.xml", "tc02"); 
Please try this instead:
Hashtable htData = CUITe.CUITe_DataManager.GetDataRow(typeof(DTAF_Draft.Tests.Modules.D3_POC), "DTAF_Draft.Tests.TestData.Test.xml", "tc02");
Also, make sure you have selected "Embedded Resource" for the "Build Action" on your XML file in your test project.

Thank you.
Oct 11, 2013 at 4:39 PM
Hi icnocop,

I tried the solution proposed by you but ran into the same problem.

For now I am resorting to the change that I mentioned above.

Regards,
Ankit
Coordinator
Oct 16, 2013 at 9:42 AM
Hi Ankit,

If you'd like to me try and troubleshoot further, please provide a sample project that can reproduce the issue.

Thank you.