Forum Discussion

yingkai1208's avatar
yingkai1208
Contributor
11 years ago
Solved

Concurrency testing in Testcomplete

Hi, 



Can Testcomplete handle concurrency testing?



An application in my company could be opened as more than one instance, and I need to test that doing some actions on one instance will cause what kind of impacts on another instance.



Personally I think it could be tricky because the two instance in object browser have exactly same mapped name and the only difference is the index. So I think if I use TC to do concurrency testing, I only could use object's full name.



Any advice is appreciated.



Cheers

Kai
  • Hi Kai,



    Definitely, I did not have an idea to remap everything for one of the DataFlows. :) The idea was to change namemapping for just DataFlow1 so it used not only process name, but also ProcessIndex set to 1.



    Hovewer, if you are saying that you may have more than two dataFlow processes running and do not mix their usage in the test code, but do something with first instance and than do something with another instance, I think that your idea should work and be even better.

    In order to implement it, you should:

    a) Make a backup of the current NameMapping.tcNM file;

    b) Delete one of the namemapped DataFlow processes with all its children;

    c) For the remained DataFlow process, select it in the namemapping tree and for the ProcessIndex row on the right click the ellipsis button (the button with three dots);

    d) In the endsuing dialog select Project Variable for the Mode field and select ApplicationIndex variable from the Variable drop-down;

    e) Save NameMapping changes.



    Now, I believe that TestComplete will select correct process instance after you set proper value to the Project.Variables.ApplicationInstance variable in your test code.

9 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Concurrency testing as you've described it is available one of two ways.  You can use Distributed Testing (click here for more) in Test Complete or you can use LoadUIWeb (click here) for load/stress testing.



    It depends a bit on what you are hoping to test.  If it's a simple test of making sure that two users operating on the same site at the same time will not interfere with each other, I'd go with the distributed testing.



    If, however, you're looking at measuring performance, scalability, etc., I'd go with LoadUIWeb for the load testing.
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Kai,



    What if instead of

     Process("PalantirDataflow")

    you try to map it as

     Process("PalantirDataflow", 1) ?



    The reason of the warning you are getting is not because more than one instance of the application is running, but because certain namemapped object corresponds to more than one actually found ones. Indeed, Process("PalantirDataflow") basically means Process("PalantirDataflow", -1) which means "any index" and thus this namemapped object matches to both Process("PalantirDataflow", 1) and Process("PalantirDataflow", 2) actual processes.



    If the above does not help and if PalantirDataflow1 and PalantirDataflow2 are always have different and constant child windows opened (e.g. PalantirDataflow1 always has 'Documents' window opened and PalantirDataflow2 always has 'Documents List' window opened), you may set corresponding window as a required child for the relevant PalantirDataflow process on the Required Children pane of the Namemapping editor. The idea is to make the set of properties that identify each PalantirDataflow process unique so TestComplete can distinguish between them.
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Kai,



    Definitely, I did not have an idea to remap everything for one of the DataFlows. :) The idea was to change namemapping for just DataFlow1 so it used not only process name, but also ProcessIndex set to 1.



    Hovewer, if you are saying that you may have more than two dataFlow processes running and do not mix their usage in the test code, but do something with first instance and than do something with another instance, I think that your idea should work and be even better.

    In order to implement it, you should:

    a) Make a backup of the current NameMapping.tcNM file;

    b) Delete one of the namemapped DataFlow processes with all its children;

    c) For the remained DataFlow process, select it in the namemapping tree and for the ProcessIndex row on the right click the ellipsis button (the button with three dots);

    d) In the endsuing dialog select Project Variable for the Mode field and select ApplicationIndex variable from the Variable drop-down;

    e) Save NameMapping changes.



    Now, I believe that TestComplete will select correct process instance after you set proper value to the Project.Variables.ApplicationInstance variable in your test code.
  • Hi, robert



    Thanks for the reply.



    I made some research on Distributed Testing and LoadUIWeb, but neither of them is what I wanted.



    I put the hurdle as follows in a more detailed manner:

    In Object Browser in TC, I have the following structure

    Sys

         Process("PalantirDataflow", 2) (let's call it Dataflow 2)

         Process("PalantirDataflow") (let's call it Dataflow 1)



    PalantirDataflow is a product in my company, I mapped loads of controls in this product, and functions are all based on the mapped name.



    Now I need to do a concurrency test, e.g. Action A: delete a document in Dataflow 1.  Action B: check the document is deleted in Dataflow 2. These two actions are executed in the respective instance on one computer, and the two instances of Dataflow in the computer keep open all the time.



    The issue is when I do the Action A, TestComplete gives me a warning message: ambiguous recognition of the tested object. It makes sense since there are two instances opened. So, is there a way that I could specify which instance I am going to deal with?



    I tried a method that, since the only difference between the two instances is the index, so I set the index of the instance as a project variable. The exploratory test is as follows:




    Project.Variables.applicationIndex = 1

    Sys.refreshmappinginfo (also tried dataflow.refreshmappinginfo, neither works)


    Do Action A


    Project.Variables.applicationIndex = 2

    Sys.refreshmappinginfo (also tried dataflow.refreshmappinginfo, neither works)


    Do Action B



    Is there a method could overcome this hurdle?



    Cheers.

    Kai

     

  • hi, alexei



    All the child objects and windows under the two instances are exactly the same. 



    If I read correctly of your reply, you suggest me to re-map all the child objects in Dataflow 2, so TC could distinguish the objects under different instances.



    There exist issues regarding this idea. 1. remapping all the objects is a very heavy work. 2. in this concurrency test, there are two instances, but in later test, it could involve more instances. Re-mapping all same objects and windows (yes, they are not exactly same, but the only difference is they are under differenct instance) is not an efficient way.



    So I am looking for an idea that I could switch between instances and then I could do an action on a desired instance. And since I have mapped all child objects and windows under an instance, it would be fantastic if I could reuse those maps. 



    So is there a method that I could do like



    Project.Variables.applicationIndex = 1

    'now the target instance is Dataflow 1, all the mapped child objects and windows are assigned to be 'under Dataflow1. TC will execute actions on Dataflow1




    Project.Variables.applicationIndex = 2

    'now the target instance is Dataflow 2, all the mapped child objects and windows are assigned to be 'under Dataflow2. TC will execute actions on Dataflow2



    Cheers.



    Kai





  • Hi, Alexei



    Thanks for the reply, it is very valuable. I think I am on the track to sorting this issue out. Could you help me with the following two issues?



    1. Currently I map palantirDataflow as Process("PalantirDataflow"), I think I need to remap it as Process("PalantirDataflow", 1). How could I remap it? 



    2. After I specify a value to applicationIndex, do I need to use the function refreshMappingInfo? and if i need to, should I do


    Project.Variables.applicationIndex = 2

    Sys.refreshMappingInfo






    I attach 3 images which I took after setting a project variable to the dataflow process index

    image1: properties of Process("PalantirDataflow") (The other issue is for the first dataflow, the index 1 does not display)

    image2: properties of Process("PalantirDataflow", 1), we could see it becomes unmapped.

    image3: screen shot of name mapping editor. we could see that only the dataflow without an index has been mapped, as well as its children objects and windows. I need to reuse those existing maps.



    Cheers.

    Kai



  • Hi, Alexei



    I have sorted it out with your help! Thanks so much.



    Following is the psyduo code:


    Project.Variables.dataflowIndex = 2


    Aliases.PalantirDataflow.refreshMappingInfo


     


    Project.Variables.dataflowIndex = 1


    Aliases.PalantirDataflow.refreshMappingInfo






    I tried to apply project variable on Process and Wnd, and I found for process, I need to refreshMappingInfo, and for Wnd, I don't have to use the function.



    Cheers.

    Kai
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Kai,



    Sorry for not replying you yesterday and thank you for the update and sharing your findings as for RefreshMappingInfo (I thought (though was not 100% sure) that RefreshMappingInfo is not required, so thank you for this info).



    Just in case:

    > 1. Currently I map palantirDataflow as Process("PalantirDataflow"), I think I need to remap it as Process("PalantirDataflow", 1). How could I remap it? 



    In order to change the mapping for the already mapped object, you must have this object on the desktop so that TestComplete can find it (in your case the application must be running). Then you should select the mapped object in the NameMapping tree, right-click it and select Edit. This will open the mapping editor where you can add/remove identification parameters and also switch Extended Find mode.