Run test created with VS plugin with resource file (.resx) in Test Studio

6 posts, 0 answers
  1. Davide
    Davide avatar
    13 posts
    Member since:
    May 2015

    Posted 10 Jul 2015 Link to this post

    Hi all,
    I'm creating a list of tests for a web application, and I'm using a Resource file (.resx) to localize different strings, so that I can run them for different languages.
    It works fine when I launch the tests in Visual Studio, but it doesn't find a reference to the .resx file when i load the project with Test Studio.
    What do i have to do to resolve this issue?

    Thank for the support.

    Davide

  2. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 10 Jul 2015 Link to this post

    Hi Davide,

    I'd like to see exactly how you're trying to use this .resx file in your Test Studio tests. Can you send me a sample Test Studio project that demonstrates this issue? Just put the folder into a .zip file and attach that file.

    Regards,
    Cody
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
  3. Davide
    Davide avatar
    13 posts
    Member since:
    May 2015

    Posted 13 Jul 2015 Link to this post

    Hi Cody,

    thanks for the support, here a simple demo with resx file

    I have another question
    In VS, if I launch multiple (indipendent) tests using the VS's Test Explorer, sometimes some tests fail without a reason. An example, it's not recognized that an element is not visibile anymore, but if I launch the test alone it works well.

    It's a problem of VS?

    Using Telerik tools this doesn't appen.

     

    Thank again

    Davide

  4. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 13 Jul 2015 Link to this post

    Hi Davide,

    Thank you for the sample project. I was able to reproduce the problem and now I fully understand what exactly is going on. First please pay close attention to the reported error:

    System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "TestStudioProject.Resource.resources" was correctly embedded or linked into assembly "TestStudioProject" at compile time, or that all the satellite assemblies required are loadable and fully signed.

    The .resx file is actually another type of source code file. You can have more than one of them in a project. Just like your .cs files they get compiled into binary code as a .resources file. At run time the static Resource class searches the .resources file for the specified resource in order to use it.

    Unfortunately the Test Studio IDE does not understand .resx files. As a result it does not compile them to generate a .resources file for the test to use. As a result at runtime the static Resources file cannot find the specified resources.

    As an alternative I recommend you use either:

    1) A data driven test. This is probably the easier approach to what you're trying to achieve.
    2) An app.config file, the content of which can be set via Visual Studio settings as shown in the attached screen shot. We also have this article how to correctly use the app.config file.

    "In VS, if I launch multiple (indipendent) tests using the VS's Test Explorer, sometimes some tests fail without a reason."

    I have no explanation for this. I would like to track this as a separate problem in a separate ticket so it doesn't get mixed up with the .resx issue. Please start a new support ticket or forum thread on this new problem. In there please attach the test log showing the failure. We'll start diagnosing the problem based on what the log shows us.


    Regards,
    Cody
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
  5. Davide
    Davide avatar
    13 posts
    Member since:
    May 2015

    Posted 15 Jul 2015 in reply to Cody Link to this post

    Hi Cody,

    I used a settings file, because it is similar to the resx one, and it works good.

    For the other question I saw better what is the problem and i'll open a new ticket.

     

    Thanks for the support.

    Davide

    I created a .settings file, because it has a structure similar to the resx one, and it works good :)
    I created a .settings file, because it has a structure similar to the resx one, and it works good :)
    I created a .settings file, because it has a structure similar to the resx one, and it works good :)
  6. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 16 Jul 2015 Link to this post

    Hello Davide,

    Wonderful! I'm glad I could help.


    Regards,
    Cody
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!