How to work with linked script files. Testcomplete - testcomplete

Have a problem with linked files in TestComplete 9.
Model of problem:
In one project suit I have couple projects.
First project (Project_1) have all script files that are used in common. e.g. Utiles1.sj, Utiles2.sj ... etc; Helper1.js ... Verify.js
All other project have linked script file Utiles1.sj from Project_1.
For now everything is OK.
Next, in Project1 in Utiles1.sj I used //USEUNIT Helper1 (Exists only in Project_1)
To make project lived I have linked Helper1 to all project where I need functionality from Utiles1.sj
In result when i have a lot of such project and such files I should link link link.
Is there a workaround for such case with minimum effort to spend?
Thanks in advance.

You can put your shared script units to a separate folder on the hard drive. When you need to link them to a new project, open this folder in the Add Existing Child - Script dialog and press the Ctrl+A shortcut to select all files in order to avoid adding them one by one.

USEUNIT unitA
at the top of your script where you wanto import and then you can use the functions of unitA in your current script file

Related

Where are Visual Studio 2013 Solution Folders?

My Current Situation:
I had a solution in which I split a large MVC project into two smaller projects. Of course the two smaller projects reference the same JavaScript and content files that were in the old larger project.
What I wish to do:
Instead of duplicating the scripts and content in the 2 projects, I want to create a shared folder that the 2 project refer to using something like a link or a shortcut.
How I am trying to approach the problem:
I think that solution folders are the solution to my problem. So I want to create a solution folder to which I will move all my scripts and content files.
However, my problem is that I have to move file by file to this folder since we cannot simply add an existing folder (I moved the scripts and content folders to the solution directory itself instead of being inside a specific project). And this is so tedious.
Here is what I tried to do:
First I tried to locate where solution folders are created. However, I discovered that solution folders don't physically exist. I think they are just some kind of logical structuring to your solution. Whenever you add a file to a solution folder it is physically added to the solution directory.
I thought that the solution file (.sln) may contain the configuration of solution folders and their content in some kind of xml format. However, this doesn't seem to be the case.
I opened the SQL Server Compact Edition file (.sdf) of the solution thinking that may there is a DB table that describes the solution folders. However, this also doesn't seem to be the case.
So, finally, my question is:
Is there any easy way to add an existing folder as a solution folder in order to avoid adding files one by one (I have too many files).
Update:
Thanks for the answers and suggestions. I ended up taking a somewhat different approach. I used a pre-build command: XCOPY "$(SolutionDir)Files\*.*" "$(ProjectDir)" /E. I did this because the suggested solutions and my previous attempt was to add links/shortcuts to the external resource files. While this was fine and shortcuts were actually added to the project, when I tested the MVC project, IIS didn't manage to load the resource files since it looks for physical files (of course).
So my query now is: is there someway, whether a build event or and configuration in the csproj file, to "Include In Project" the newly "physically" copied files?
As drew advised: editing the project file is one way. Another way is to edit the Solution file in a mechanism similar to that of the csproj file.
In a solution file, a project with a specific GUID holds the details of a set of folders.
Write a small app that will read your folder and output a small text of the desired output. Generate new Guids until the file is created. Just paste this at the top of the .sln file. 2150E333-8FDC-42A3-9474-1A3956D46DE8 seems to be the GUID used for Solution Items.
This sample has a few subfolders with content in a nested structure.
i.e.
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NewFolder1", "NewFolder1", "{4CDFCC66-45BD-4B6D-8758-FEF7E9F61C1C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SubFolder1", "SubFolder1", "{771BDBFB-5C01-4C51-A170-D88ECA8DE896}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SubFolder2", "SubFolder2", "{5D23AB90-5EF6-4611-A575-34F7B50BB1B6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NewFolder2", "NewFolder2", "{135E9F67-2DF8-4458-AC6D-FF82FC1B3BC6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SubSubFolder1", "SubSubFolder1", "{B41C7BAA-7E3D-405B-96AB-005120D12D26}"
ProjectSection(SolutionItems) = preProject
NewFolder1\SubFolder1\SubSubFolder1\a.txt = NewFolder1\SubFolder1\SubSubFolder1\a.txt
EndProjectSection
EndProject
Solution folders (on the file system) are optional, and in Visual Studio they're typically used just to organise files within Visual Studio.
It's a manual approach to create a "physical" folder at the same level as the solution but this reduces complexity.
Below are the steps for moving a single script file:
On the File System
Create a solution folder (typically at top-level directory)
Copy script file from (one) project to solution folder
In Visual Studio
Create a solution folder
Right-click solution folder, select Add > Existing item...
Select script file from the new solution folder on file system, then click Add
Exclude/Remove script file from project1
Right-click project1, select Add > Existing item...
Select script file from solution folder on file system, select "Add as link" from the drop down on the Add button
Repeat steps 6-8 for all other projects
By using "Add as link" the main thing we've done is to add a reference to the script in the solution folder as opposed to the actual file being copied to the project folder.
Note that you're not limited to working with one file at a time, it's just easier to track.
The fastest way I know of to find where you solution folder is located:
Within Visual Studio, open the "Solution explorer if it's not already open View -> Other Windows -> Solution Explorer (CTRL + ALT + L)
Within the solution exploerer, Right-click your project or solution
Select Add -> New Item.
The window that pops up will allow you to select a new file template, but what you're looking for is the "Location" field at the bottom. It should have the path to your solution folder. It's a safe bet that your solution folder is at this location or up a couple levels.
Once you get the path to your solution folder you can click Cancel to exit the wizard.
As far as I can tell, visual studio doesn't provide this feature through their interface. The intention probably is that project files exist within the project folder rather than being separate. It generally makes working with projects easier (moving, sharing, etc).
That said, you don't have to have every real folder in a project location actually included in that project. So you could do something like the following folder structure:
+ /Projects (contains ProjectA.csproj and ProjectB.csproj)
|
+-- /ProjectA (folder with files that are just for "ProjectA"
|
+-- /ProjectB (folder with files just for "ProjectB")
|
+-- /Shared (Folder with your shared scripts/files)
With this structure you should be able to use the "Show All Files" button and include the shared folder in both projects. You will probably need to manually edit the csproj files to map to this new structure but it shouldn't be too difficult.
The only other option I can think of is to try to manually edit the csproj files such as this question shows.
Hope that all helps. Best of luck!
My final solution to the problem is a combination of the solutions suggested answers and the approach I decided to take so that local IIS can see the files.
I added the following section to the csproj file:
<Content Include="..\Files\**">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
</Content>
I also added the following command as a pre-build event in my project:XCOPY /y "$(SolutionDir)Files\*.*" "$(ProjectDir)" /E

want to use Xcode 4 for everything, how to add folder in project navigator?

I'd like to move my web dev editing to Xcode 4 (currently using textmate). I have a couple of simple questions that are clearly a lack of experience on my end.
In Xcode's Project Navigator, how do I add a folder to the shown directory tree? Currently, I add via terminal and do File -> Add Files
Is there any way to tell Xcode to see the file system as the file system and not as references?
a less likely thing:
Is there any way to bring up a console within the context of a folder in project navigator (would like to be able to run grep again small portion or something)?
thx
I can answer the first question. Adding a folder of files to a project is the same as adding individual files. Choose File > Add Files in Xcode. When you add a folder of files to a project, you should see something like the following screenshot:
Create groups if you need to access the files in Xcode, such as adding a folder of source code files. Create folder references if you don't need to access the files in Xcode, such as adding a folder of audio files.
You can also add folders to the project navigator by selecting a file or folder in the project navigator, right-clicking, and choosing New Group.
As far as I know, Xcode won't mirror the filesystem as an Xcode tree (anyone correct me id I'm wrong). Wanting to have an identical structure is quite some work. I use to first place the files hierarchically in the file-system, then I mimic the same structure in Xcode.
This requires some attention since Xcode 4.1 not always writes new classes to the place you told him to - they may prefer to land in the highest level of the Xcode project.
I had similar thoughts and started a thread, might be helpful for further reading
Your second question: sorry, can't help you there.

Why can't I delete files from my XCode project?

This is probably a very easy question, but I'm having trouble deleting resources from my XCode project. I added them using "Create Folder References for any added folders" so that I could import a whole offline HTML site with its correct folder structure.
Unfortunately, now it has been added like this I don't seem to be able to delete individual files in the structure (it's not available from the Edit menu).
Can anyone help please? Thanks!
That isn't how folder references work. The idea is that its only a reference, you can open files within it and save it from those editors, you can delete or move the entire reference throughout the xcode project, but you can't actually edit it - its read only as far as xcode is concerned. Likewise, you cannot restructure it (move internal files around).
I'm not to sure why apple decided to make this the case, but apparently they have.
If you want to know how one might use the xcode folder system, here's how I tend to use them with my projects:
Whenever I subdivide code into folders, when I drag them into my project I click "recursively create groups for any added folders". If you do this, you any changes you make within xcode will not reflect the actual file itself. As far as I know, there is no way to do this. What does happen then is that when you add a new code file to it, the directory starts off in that file by default. ie, you don't need to navigate to it manually when you create a new file.
I use folder references whenever I'm working with content for an application I'm using. This way, I add all my images, folders, configuration files, whatever - and xcode immediately lists them. The reason I have it within xcode, I can I copy the files into the executables directory by dragging the folder reference into a "Copy Files" build phase.
Thats basically (to my knowledge) how one uses the folder types within xcode - sadly, I don't know how to achieve the functionality you want. You may have to manually delete the folders in finder, which if you do use folder references will update xcode to the change.
I ran into the same issue by using "Create Folder References for any added folders". I wanted to change some of the times but that's not possible. I had added a main folder that had other directories under it. I just had to select the main directory and deleted it and then just add the subdirectories that I needed. You can't make any location or removal changes to the directories that are added this way. -- Jeff
In the project browser, where you're looking at files, right click and choose "Delete". It'll prompt you to either remove the file from the project (leaving the underlying file on the filesystem) or to also move the underlying file to the trash.
I ran into the same issue. Delete the files from the folder directly as opposed to from within Xcode. You'll see the entries turn red under your project. Restarting Xcode should make these red entries vanish.

How should I organize my Xcode project files?

I'm trying to wrap my head around Xcode's file organization - or lack there of. I can do all I want in project and it looks great with all the "fake" folders and structure. I go look at the file system and boom HUGE mess. I've tried importing files with the Create Folder Reference for any added folder option checked and that works, kinda. I get the structure I want both in Xcode and on the filesystem.
Issues: When I add a file to a folder on the filesystem that is a Folder Reference in Xcode, its not in Xcode when I go look, not even after reloading the project. Files/Subfolders in a Folder Reference can't be moved around in Xcode. When I move them on the filesystem I get red links (can't find the file?) in Xcode.
How do I keep a organized project and filesystem? How can I set up a project to just recognize a folder and show its (current and up-to-date) files and subfolders in my project?
Another issue I seem to run into, if I use a Folder Reference and change a file, the file is not updated in my application unless I do a full clean & rebuild. If I don't use a Folder Reference, all my files are dumped into the Resource folder of the application bundle, not in the nice structure I have in my project.
Should I care at all? Should I just use the fake folders and let everything go everywhere and not care? My application bundle will be a mess, the filesystem will be a mess, but it will all work... I would hope?
Edit:
My biggest reason for wanting an organized filesystem is that the resource files (images, sounds, other datafiles, etc.) are not edited in Xcode. I have to access them in 3rd party apps via the filesystem. If its a mess things are harder to find and maintain in the other 3rd party applications.
Also what happens if I want a structure like the following:
Images/Backgrounds/Name.png
Images/Icons/Name.png
Images/Titles/Name.png
Should I use long filenames rather than folders to organize?
Images_Backgrounds_Name.png
Images_Icons_Name.png
Images_Titles_Name.png
I also wish Xcode automatically kept itself and the file system in sync.
So much so, that I spent an hour doing so manually for a project called acani-iphone on GitHub. Basically, I just moved some of the files around using Finder, creating new folders as I pleased. Then, I switched back to Xcode and saw that the files I just moved were now red (because Xcode was thinking they're where I moved them from and so couldn't find them).
UPDATE: I just figured out that I could've then just clicked on the red group or file, pressed CMD+i (Get Info from the context menu, which you can open by right-clicking on the red file or group), and under the General tab, clicked Choose, then found where I moved the file to in the filesystem. But, I didn't do that, here's what I did instead, which also works:
Then, I just highlighted all the red files in Xcode and pressed command + delete to delete the broken (red) references. Then, I right-clicked on the Group I wanted to add the files to (usually the same group), and clicked Add > Existing Files.... Then, I found the same files in the new spot on the file system. I kept "Copy items into destination group's folder (if needed)" unchecked, I checked the radio button "Recursively create groups for any added folders," and I checked add to target acani if the files I was adding were being used to build the acani iPhone app.
I did the above with like a directory of files at a time. A few times I was more aggressive, adding multiple directories at a time, since I almost always selected the radio button "Recursively create groups for any added folders."
I found out that the files acani_Prefix.pch and acani-Info.plist had to stay in the root file system dir (although there may be settings you can set to allow these files to be elsewhere, like I think you can add a line to acani-Info.plist so that you can move/rename acani_Prefix.pch, but I'm fine with them in the root dir on the file system.
That was annoying to do, and perhaps not even worth the trouble, perhaps procrastination, but going forward, before adding existing files to Xcode, I'll first make sure they're in the place I want them to be on the file system.
OK, so here is how it works:
Xcode doesn't know about any files until you tell it about them. That is, even if you add a file manually in the finder (usually a bad idea) to a folder that contains files in an Xcode project, it doesn't know about them until you "add existing file to project".
The best practice (imo) for adding an existing file (or group of files) to a project (say, some code you just downloaded) is to choose "add existing files" and then "copy items to destination group's folder (if needed)" in the next dialog, if you want your project to have a copy of the files in question, rather than merely a reference to them (there are advantages and disadvantages of both).
Don't worry too much about the naming of folders in Xcode, or where you put things, but try to keep to a standard that makes sense in your environment. For example, I always put the classes I write in "Classes", and have separate folders for any library code i've downloaded for use in the project. I always put images/icons/audio etc in to "Resources".
In short, if you like what's in the project folder to be approximately the same as what's in your project, always add existing files by choosing the "copy items to destination group's folder"
The flexibility in XCode is intentional. It's up to you to decide how you like to organise things.
Should I care at all? Should I just use the fake folders and let
everything go everywhere and not care? My application bundle will be a
mess, the filesystem will be a mess, but it will all work... I would
hope?
IMO no... :) basically. The whole point is that XCode has been designed to give you the best experience of programming. If Apple wanted you to physically organise all your files and folders within the actual filesystem then they would have made it that way.
I don't really understand why you would want to organise all the files and folders in this way anyway? It makes no difference to the running of the application and the "fake" folders (groups) in XCode adequately provide the necessary visual aid for yourself (and others) to navigate through your classes and other resources. Organising it correctly in your filesystem (as you have found) surely just makes things more difficult?
Use Synx.
It rearranges your files on disk to match your Xcode groups. I try to run it before committing any code that changes the Xcode groups, and it keeps the project nice and tidy.
It would be great if Xcode could keep itself and the file system in sync. Unfortunately it doesn't. One reason for wanting it to is so the hierarchy in your SCCS matches the one in Xcode.
I fall back to keeping things organized in Xcode, and leaving the file system separated into not much more than "Classes" and "Resources".
This changed with Xcode 9. From the release notes:
Groups in the Project Navigator are now more closely associated with
directories in the file system. (28612132)
Dragging files between groups in the Project Navigator moves the files in the filesystem and updates any associated SCM working copies.
When a group is connected to folder in the filesystem, creating, renaming, and deleting groups updates the corresponding files and
folders in the the filesystem.
To remove a connection between a group and a folder in the filesystem, select the group, and then open the File inspector and
click on the on the Clear path button (X).
To add or update an association from a file or a folder in the filesystem to a file or a group in the project, select the file or
group, open the File inspector, and drag the corresponding file or
folder onto the Location section in the File inspector.
The new behaviour is available from the 'New Group with Folder' command (which may appear as just 'New Group'), while the old behaviour is available from the 'New Group without Folder' command (which may also appear as just 'New Group'!) The dominant usage amongst any existing groups in the target folder seems to determine which command gets labelled 'New Group'. It's more than a little confusing, but if you are in the habit of choosing one or the other, the idea seems to be that you can just stick with the default 'New Group' command. (See rob mayoff's far more thorough explanation.)
What I do is create a group to represent each folder and then, before adding files to it, in the right panel, first tab, immediately below "Path", there is an icon that allows you to choose the folder. In that folder dialog, I create a folder that matches the group and choose it.
In xcode3, this resulted in new and add files dialogs starting in this path. That made it worth the effort. Xcode4, however, does not respect this setting. Therefore, its questionable whether there is any real value in it. I also wish XCOde would support better file system organization.
Considering that file names must be unique within a project, regardless of groups and folders, there is justification for accepting the flat folder structure default and using groups for IDE convenience. Its difficult to come from other platforms where this is frowned upon.
i feel you and personally cannot NOT care about the actual structure and just rely on workspaces.
what would be really great is a tool that will go over the workspace structure and re-organize the file system accordingly, taking care of any re-naming of folders etc. this would be a classic solution and IMHO should be implemented as an option as we re-organize our project as we move about it.
some issues could be source control though xcode4 works with both git and SVN.

Xcode File management. What is best practice?

I've been using Xcode for a while now. One thing that always bugs me is the way it handles files. I like to have my files all in nested folders rather than one big physical folder, but when you create a group in Xcode by default it does not create a folder just a virtual folder within the project.
I can see that virtual folders are great for linking code in arbitrary places into your project but once you get beyond a few classes I find the one big folder approach really painful. And then if you try to fix it later it takes ages and is easy to break your build.
Is it possible to change this behaviour so that by default it creates a physical folder? Or am I doing it wrong and trying to cling to some other way of working? How do other people work with files in Xcode?
1) Remove all the files from the project. Select All and press Delete, and click the Delete File References button, not the Also Move to Trash one.
2) Go to the Finder or Terminal and rearrange your files in folders to your heart's content.
3) Select all the top-level files and folders and drag them back into your project. When given the choice, choose Create Groups for Added Folders.
You'll now have a group hierarchy that follows the directory hierarchy on disk.
You'll need to make sure all the proper files get back into their correct build phases and targets. It's best to do this one target at a time in a multi-target project.

Resources