Variables set to null

3 posts, 0 answers
  1. wilfredo
    wilfredo avatar
    13 posts
    Member since:
    Jun 2011

    Posted 17 Aug 2011 Link to this post

    Hi,

    My problem is that we have aTest.cs and a.cs.
    a.cs contents a variable which will be used until the all testmethods under aTest.cs are finish, but after the first test method the variable is set to null so the remaining test methods will become failed.

    Thank you.


     
  2. Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 17 Aug 2011 Link to this post

    Hi Wilfredo,
        I couldn't figure out the exact setup you're using from your description.

    Is the variable defined in a.cs static?
    Is the variable initially not initialized (i.e. =null) ?
    Do you initialize it in the first method of aTest.cs?

    My guess is that the issue is related to scope. If the variable is non-static and you're creating an object of type a.cs: there's no way that you can access this object and the value for the variable in a different method. They best thing would be for you to share the code for aTest.cs and a.cs. If you choose to do that please put in some comment next to the lines of code that are related to the variable so that we may readily identify them.

    Best wishes,
    Stoich
    the Telerik team
    Vote for Telerik Test Studio at the Annual Automation Honors Voting!
  3. wilfredo
    wilfredo avatar
    13 posts
    Member since:
    Jun 2011

    Posted 17 Aug 2011 Link to this post

    problem is solve. variable should be static and i declare it as non-static.

    can this thread be deleted. because i think it's just a simple problem.

    thank you
Back to Top