Forum Discussion

thebick's avatar
thebick
Occasional Contributor
5 years ago
Solved

aqFile* Exists not find application-created folder

My application creates a folder during execution, but TestComplete's aqFile* methods don't find it during the test.

Not aqFile.Exists, not aqFileSystem.Exists, not aqFileSystem.FindFolders. (But they do find the already-existing parent)

If I leave the folder in place and run a second test, it finds the folder.

If I call CreateFolder() during the test, FindFolders() finds only that folder, not the one my app created.

I'm running on a Windows 10 VM on Windows 10. The folder is on the host, shared with the VM.

The test is written in Python.

How can I get TestComplete to find the folder that my application creates during the test?

 

Correction: The folder is on the VM, not shared from the host


  • thebick wrote:

    Not sure I understand what you mean.

    When the application creates the folder (and a lot of sub-folders), I can see it easily in File Explorer -- just not via TC.

    I do not have access to source code, so I can't change how it behaves.

     

    Or are you suggesting something else?


    The suggestion is, as mentioned, system delay time.  Consider Button click happens and then the next lines of code execute almost immediately.  That might not be enough time to find the folder in the Windows file system (which is what aqFileSystem essentially is... a TC wrapper around around the FileSystem object from Microsoft).  So, perhaps a "delay" time of some sort... maybe a while loop to wait until either the folder exists OR you reach a maximum timeout.  Obviously, ParentDir exists by the time you get to creating bogus folder otherwise bogus folder wouldn't be found... so, there's a processing time there that needs to be accounted for.

5 Replies

  • Wamboo's avatar
    Wamboo
    Community Hero

    Hi thebick,

     

    Can you share with us a code example?

      • thebick's avatar
        thebick
        Occasional Contributor

        Not sure I understand what you mean.

        When the application creates the folder (and a lot of sub-folders), I can see it easily in File Explorer -- just not via TC.

        I do not have access to source code, so I can't change how it behaves.

         

        Or are you suggesting something else?

    • thebick's avatar
      thebick
      Occasional Contributor
      # Portion of test script written in Python
      # FormToCreateDirectory has already been properly assigned
      # This function works and creates the directory
      FormToCreateDirectory.OKButton.ClickButton()
      parentDir= "D:\\parentDir"
      if not aqFileSystem.Exists(parentDir):
         Log.Error("Can't find " + parentDir)
      # If I don't have this line, foundFolders is None
      aqFileSystem.CreateFolder(parentDir + "\\" + "bogusFolder")
      foundFolders = aqFileSystem.FindFolders(parentDir)
      if foundFolders != None:
          Log.Error("No folders in " + parentDir)
      while foundFolders.hasNext():
         aFolder = foundFolders.Next()
         Log.Message("found folder " + aFolder)

      The only Folder found is bogusFolder