Workspace Contexts are responsible for preparing the initial workspace content for your test case. The Workspace Context contains or links projects and files you need to place in your workspace before running your test. It also has an option to clear the workspace before applying your Context. That is, if the Clear workspace option is turned on, the Workspace context just replaces the entire workspace contents. Otherwise it verifies that all of its items are present in the workspace and have the same properties. If not, it creates missing items or replaces modified items correspondingly.
The Workspace Context editor allows either to manually construct/modify/link the content of your Context or capture the workspace state from the AUT.
With the Capture button in the upper-right corner above the Context name field you can capture the current state of the AUT workspace. With a single click all the project with all their files and subfolders will be added to your Context.
Otherwise, you can manually add/import/link Projects and Files using the corresponding buttons. There are the following options to edit Context data:
- Create Empty Project: creates a new Project in the Workspace defined by your Context
- Create Empty Folder: creates a new Folder within the selected project
- Import Projects: opens a dialog window where you can browse and import any existing Eclipse projects to your workspace:
- Import Files:opens a dialog window where you can browse and import any files to your workspace:
- Link Workspace Project: links project or project folder from workspace as a top-level project into context
- Link Workspace Folder: links folder from workspace as a child folder under selected project or folder
- Link Workspace Files: links files from workspace as a child files under selected project or folder
- Open File: opens the selected file in the Test Editor allowing you to edit the file content
The option to clear the workspace is checked by default. You can uncheck it in order to keep data preceding your test.
Benefits of linking
Approach of manual creation of projects/folders/files has one important drawback. If files have changed, you have to manually re-import them every time, or even re-create projects and folders hierarchy. That is because of imported resources are embedded into Q7 contexts. Using workspace resources linking you may avoid this drawback, and keep your resources always up-to-date – that way resources are linked from the workspace, not embedded.
Don't forget to include projects with linked resources into Q7 Runner
import argument, if you use it to run your tests.