Forum Discussion

Oferv's avatar
Oferv
Super Contributor
14 years ago

button enable status is changing

Hi,



i'm running an installation and checking button's state during the screens changing.in the first screen the BACK button is Enable=False but if you click the next button the BACK button is now Enale=True since i created one instance of this button's identification in the namemapping defenitions and the value i'm checking for the first button is Enable=False then for the second screen this enable will fail.

what's the best way of testing that?should i create different value for the first screen BACL button and seperate for the second screen and so on or is there a better way of solving that?



thanks

10 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    I would not use the Enable property as a mapping criteria.  I would suggest you find a different set of parameters to uniquely identify the Back button so that you're not dependent upon the property being False to identify the button.  I would actually use a combination of WndClass and WndCaption as the best identification for that button.
  • Oferv's avatar
    Oferv
    Super Contributor
    Thanks,

    I don't use the enable/disable property as to identify the object.i do use what you suggest but, the button in the first screen is disabled and for the next few screens it's enable.so i used simple code line for testing it's status as follows:




    //Check the buttons caption in the first install screen   

       if(Aliases["MSIEXEC"]["BaseScreen"]["btnBack"]["WaitProperty"]("WndCaption", DDT["CurrentDriver"]["Value"]("CheckPoint"),5000))

        Log["Message"]("PASS "  + DDT["CurrentDriver"]["Value"]("Component")  + " Checkpoint",Aliases["MSIEXEC"]["BaseScreen"]["btnBack"]["WndCaption"])

       else

        Log["Message"]("FAIL "  + DDT["CurrentDriver"]["Value"]("Component")  + " Checkpoint",Aliases["MSIEXEC"]["BaseScreen"]["btnBack"]["WndCaption"])

        //Log a Picture of the object   

        Log["Picture"](Aliases["MSIEXEC"]["BaseScreen"]["btnBack"],"Picture of the object")

        //Check if the value of the Enable property of the button is True or False

        if(Aliases["MSIEXEC"]["BaseScreen"]["btnBack"]["WaitProperty"]("Enable","False"),500)

          Log["Message"]("The BACK button status is DISABLE")

        else    

          Log["Warning"]("The BACK button status is ENABLE")



    is that the right way?is there a better way.i must say that i can see the time it takes TC to verify this enable value during runtime.



    thanks
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    The problem, then, is not the code that you're running.  It's good code for testing the status of the button.  The problem is that your code is not contextual to what it is you're testing.  On the first screen, you want the button to be disabled.  On the second and consecutive screens, you want the button to be enabled.  So, using the code you have for all screens will be a problem.



    What you need to do is actually pass in some sort of contextualization to your test to say "This time, I want the button to be enabled".



    Since you're using a DDT driver already, you might want to specify in your DDT file what the expected status of the button is.  You're already testing the expected caption, so you could do something similar with the Enabled status.
  • Oferv's avatar
    Oferv
    Super Contributor
    One thing is bothering me,i have to test around 15 language and i create a condition for each one of the languages.is it going to take long time to get the right value?or TC have a sophisticated mechanisem to do it faster?
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    The "Enabled" property of the button is language independent as it is a boolean true/false result.  So, I'm not entirely certain how applying different languages will affect the test of enabled/disabled.  It will affect your component WndCaption test so you'll have to, in your data file you're using for DDT.CurrentDriver, have different test cases for different languages, but the enabled property won't need to be changed.
  • Oferv's avatar
    Oferv
    Super Contributor
    yes yes i'm talking about the WndCaption property.i need to add condition for all languages,right now i have only 2 languages but i guess that when i'll have more (like 15) it will take TC more time to perform the comparison and it will take it a lot of time isn't it?
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    What I would do is somewhere in your test parameters, perhaps in a project level variable, set what language you're testing.  So, say you're going to do a test run of English.  You set your language variable to English.



    What you would do then is set up your DDT file a little differently.  I would add a column to your DDT file for language.  Then, in your looping through the file, compare the record in the file to the global variable.  if they match, proceed with the test, if they don't, skip it.



    Then, when you want to test another language, change your global variable and try again.



    This is only one way of doing it but you'll need to set up these parameters in some way to tell your test what is being tested.  Will it take longer?  You are adding more test cases so, yes, it will take longer however, the ability of TestComplete to compare the WndCaption to the value in the file will not take any longer since it's a simple string to string comparison.
  • Oferv's avatar
    Oferv
    Super Contributor
    Thanks,i actually need to go over all languages at the same run so what do you think about creating excel that will include all languages and run over it using DDT and then each iteration I'll edit the global variable to the current one.is it possible to edit the global variable during runtime using the code?same with the excel file, I created different file for each language (because the display text on each screen in the installation process is different for each language) so for each iteration i'll have to change this to variabels.is that possible?can you give me the code line that do that?

    thanks
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    There are a variety of ways to implement this so to give you one "code line" to explain it is not going to help.



    I'd suggest try a couple of different way of setting the global variable.  If you're going to go that route, I'd use something like a Project variable like Project.Variables.Language and set that to the string corresponding to the current language under test.