Forum Discussion

rashmidiwakar's avatar
rashmidiwakar
Occasional Contributor
14 years ago

Creating folder in windows application: keyword test

Hi,



I am using testcomplete for the first time, so 'm sorry if 'm missing something,

I want to create a test or record a test using keyword testing to "create a folder" in windows Explorer,

so that when ever i call that test it should automatically creates the folder,

here i need to have some parameters and assumptions,

what could be the assumptions,

and once i create the folder and again if i call the same test again it should first recognize whether the the same folder exists or not if exists then should give me a warning message tat folder already exists.

And also how will i create a different folder each time when i call this test,.



Here i have created a simple test to create the folder but i need to incorporate the above conditions how will i do.



Thanks,

 Rashi
  • Hi Rashi,



    See the aqFileSystem.CreateFolder help topic to learn how to handle this. To post a warning, use the Log.Warning method. To call these methods in a keyword test, use the Call Object Method operation. To randomize the folder name, you can use random number generator. To do it, when specifying the value of the Path parameter in the Call Object Method dialog, set Mode to Code Expression and specify, for example, "C:\\FolderName" + Math.floor(10000*Math.random()), if the language of your project is JScript - this code will concatenate "FolderName" with a random number from 0 to 10000.
  • rashmidiwakar's avatar
    rashmidiwakar
    Occasional Contributor
    Thank You Alex.



    I have few more question, Please if you are any anyone help me out for this,

    1. I'm trying to automate the test using keyword, for selecting all folders in Windows Explorer folderview, that is using keyboard action "Ctrl+A" but when i run this test it is failing, how wil i go about this.



    2. In windows Explorer I have two main folder, ( Folder1 and Folder2),



    when i open folder1, here i have many folders named "X" "Y" "Z" and so on, if i have to automate the test for 

    " copy" the folders either one of them or all folders "x,y,z",  so that wen ever i call this test it should copy the folders which will be parameterized,. so will i do this, i wold like to know hw can i parameterize this and passing the variable to find the objects or folders in folderview and also in treeview.



    Ways of  doing copy:

    a.CtrlC()

    b. RightClickMenu-InListOnItem

    c. RightClickMenu-InTreeOnFolder

    d. Toolbar


    Thank You.

    Rashi
















  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    There are numerous methods within the aqFileSystem object much like CreateFolder that will be useful in doing what you want.  I guess the question is, is there a reason why you need to actually do the tests within Windows Explorer?  Or is it sufficient to manipulate files using a non-UI object?
  • rashmidiwakar's avatar
    rashmidiwakar
    Occasional Contributor
    Thank You Robert,  



    I will go through that article,

    Yes, i am actually learning the test complete on my own and i am creating few projects as example. so while doing this i am stuck with these above things. 

    As i am using trial version i dont have access to look at the examples. So if u could send me the example for aqfile.copy and delete.



    Thanks,

    Rashi
  • Hi,



    Actually, samples are available in the help. For example, aqFile.Copy. If you follow this link, you'll see a navigation pane at the left where aqNNN objects and their methods are listed, and where you can find samples for them.