Create a Test Session


Overview

This page explains how to use existing Test Scenarios to create a Test Session.
Creating Test Scenarios is a mandatory step before being able to create Test Sessions.

If you're not familiar with the concept of Test Session, please take time to read the Zen4Sync Philosophy.

Zen4Sync does not provide - yet - a GUI to create Test Sessions.
Therefore the Test Session creation involves SQL Script writing.

Test Session creation philosophy

A Test Session is the execution of one or more Test Scenarios by one or more Clients.
Test Scenarios are composed of Activities, which need an Activity Context per Client.

For instance if the Test Session consists in 10 Clients executing a Test Scenario composed of 2 Activities, you'll need: 10 Clients * 2 Activities = 20 Activity Contexts.

Depending on the Activity Type, the content of the Context associated to a given Activity differs.
For instance a Merge Sync Activity needs a Merge Sync Activity Context, a SQL Server Execution Activity needs a SQL Server Execution Activity Context and so on.

Each Activity Context refers to existing resources in the database.
For instance a Merge Sync Activity Context must refer to an existing subscriber in the database.

Therefore the creation of a Test Session consists in:
  1. The insertion of all the resources needed by the Activity Contexts,
  2. The insertion of the Activity Contexts referencing the resources inserted on previous step,
  3. The insertion of the Test Session,
  4. The insertion of Clients referencing the Test Session inserted on previous step,
  5. The insertion of references between the Clients and their Activity Contexts.

Activity Contexts

The following sections explain what are the resources needed by each Activity Context.
The Zen4Sync Data Model is a precious help when creating Activity Contexts.
It'll show you what are the resources needed by each Activity Context (a resource being a table related to the Activity Context).

Merge Synchronization Context

To insert a Merge Synchronization Context, insert all the needed resources, then insert the Context.

Related part of the Data Model Table representing the Context
Merge Sync [MergeSync].[syncSessionContext]


Resources needed by the Activity Associated SQL table
Subscriber [MergeSync].[subscriber]


The subscriber contains the Connection String used to access the local SQL CE database.
This Connection String is computed by Zen4Sync using different columns.

To obtain a proper Connection String, you must respect the following rules:

Context column Value
subscriber_connectionString It must start with Data source='{0}'. The {0} will be replaced by the concatenation of the subscriber_sdfFileName and subscriber_sdfFileDirectory columns


SQL Server Execution Context

The SQL Server Execution Context allows you to specify:
  • The Connection String used by the Client executing the Activity,
  • The parameters values used when executing the SQL query of the Activity.

Related part of the Data Model Table representing the Context
SQL Server Execution [SQLServerExecution].[sqlServerExecutionContext]


Each parameter is a record in the [SQLServerExecution].[sqlServerExecutionParameter] table.
Its name must match the name used in the SQL query of the Activity.

For instance for the following query:
-- Parameters are prefixed with @
UPDATE Customer SET Points = @NewPoints WHERE Id = @Id

2 parameters must be inserted, their names set to @NewPoints and @Id.

TODO: Specify how to encrypt Connection String using EXEC [Admin].[sp_z4s_encrypt_data]

SQL Server Check Data Context

The SQL Server Check Data Context is very similar to the SQL Server Execution Context except for the tables impacted.

Related part of the Data Model Table representing the Context
SQL Server Execution [SQLServerExecution].[sqlServerCheckDataContext]


SQL CE Execution Context

The SQL CE Execution Context is very similar to the SQL Server Execution Context except for the tables impacted.

Related part of the Data Model Table representing the Context
SQL CE Execution [SQLCEExecution].[sqlceExecutionContext]


SQL CE Check Data Context

The SQL CE Check DataContext is very similar to the SQL Server Check Data Context except for the tables impacted.

Related part of the Data Model Table representing the Context
SQL CE Execution [SQLCEExecution].[sqlceCheckDataContext]


SQL CE Backup Context

TODO

MEF Component Execution Context

The MEF Component Execution Context allows you to specify Metadata for a given Client.

Related part of the Data Model Table representing the Context
MEF [MEF].[mefExecutionContext]


The Metadata you specify will be transmitted to the MEF Component along with the Activity Metadata (see How to create a MEF Execution Activity for further details on the Activity Metadata)
So you can use this column to transmit data to your MEF Component for a specific Client.

You need to make sure to insert valid and well-formed XML into this column.

For instance you could insert something like:
<SpecificMetadata>
  <Client businessId="GLD34" />
</SpecificMetadata>

Then your MEF Component will able to access the Business ID of the Client since it'll receive all the XML.

Remember that this XML is specific to the Client which will use the Context (as opposed to the Activity Metadata XML which is constant for all the Clients executing the Activity).

Test Session

Once Activity Contexts are inserted, you can insert the new Test Session in the database.

The table associated to Test Sessions is [Admin].[testSession].
See the Admin.testSession table for details.

Clients

Once the Test Session is created, you can insert Clients which reference the new Test Session.

The table associated to Clients is [Admin].[clientSession].
See the Admin.clientSession table for details.

The column where NULL value is allowed must not be filled at insertion.
They'll be filled by Zen4Sync when the Test Session will be executed.

Once Clients are inserted, you need to indicate which Context they'll use for each Activity they'll execute.
The Activities they'll execute are of course the Activities contained in the Test Scenario they'll execute (column clientSession_testScenarioId).

For each Activity of the Test Scenario, you'll need to specify a Context using the Scenario.activityContext table.

Last edited Jun 16, 2011 at 2:53 PM by Christophe_, version 22

Comments

No comments yet.