This website provides a way for you to write SQL queries that extract data from your own data source and inject these into a Test Case while it is being executed.
Installing the service
When you install the Data Driven Feed
(DataDrivenFeed.msi
) you are prompted for a site where the
service would be installed. The URL for this site will be used by the Cyara
Platform to generate Test Case parameters. It is critical that this address be
accessible from both the Cyara Web Portal and the Voice Scheduler.
Configure the database connection
web.config
file located in the root of the site.
Edit this file in a text editor and locate the following entry:
<connectionStrings>
<add name="Feeder" connectionString="Data Source=.;Initial Catalog=?;User Id=?;pwd=?;" providerName="System.Data.SqlClient" />
</connectionStrings>
Change the
connectionString
property with values for your
datasource (please refer to your Database Administrator for help with this).
It is possible to change the default connection for a script. You
can add multiple connections into the
web.config
section defined above and you can
reference these by name within the script files.
<connectionStrings>
<add name="Feeder1" connectionString="Data Source=DB1;Initial Catalog=?;User Id=?;pwd=?;" providerName="System.Data.SqlClient" />
<add name="Feeder2" connectionString="Data Source=DB2;Initial Catalog=?;User Id=?;pwd=?;" providerName="System.Data.SqlClient" />
</connectionStrings>
DB1.sql
--@connection=Feeder1
SELECT TOP 10
[Expect]
,[Reply]
FROM [STEP]
WHERE TestCaseId = @TestCaseId
DB2.sql
--@connection=Feeder2
SELECT TOP 10
[Expect]
,[Reply]
FROM [STEP]
WHERE TestCaseId = @TestCaseId
Creating a query
A SQL query is used to interrogate your database and create parameters for your Test Cases. The SQL files are located in the App_Data folder of this site.
Using a text editor, create a new file within this folder with a .sql extension. The name for this file is used to invoke the correct script when your Test Case is being executed.
The column names returned from the query must match those you have already defined against parameters of your Test Case. These column names are used to replace the parameters in the Test Case fields when your Test Case is running.
SELECT TOP 10
[Expect]
,[Reply]
,[MinorThreshold] as 'cyara.minorthreshold.1'
,[MajorThreshold] as 'cyara.majorthreshold.1'
,[MinPause] as 'cyara.minpausetime.1'
,[MaxPause] as 'cyara.maxpausetime.1'
,[MajorConfidenceLevel] as 'Cyara.MajorConfLevel.1'
,[MinorConfidenceLevel] as 'Cyara.MinorConfLevel.1'
,[PostSpeechSilenceTimeout] as 'cyara.psst.0'
FROM [STEP]
Passing parameters
The following parameters can be passed:
Custom Parameters
You can inject parameters into your query in two ways. Firstly, you can define your own parameters on the URL which will get passed into the service on the query string. This URL is assigned to the Test Case from the Edit Test Case screen.
For example, this URL will pass in an integer
TestCaseID
with a value of 14 and a string
Type with a value of value T.
http://mysite:8081/DataDrivenFeed/jsonfeed.ashx?intTestCaseID=14&strType=T
There are currently two types supported – numeric and string
(default). You can indicate a parameter is a numeric type by prefixing the name
with
int
or with a
str
for a string.

SELECT TOP 10
[Expect]
,[Reply]
,[MinorThreshold] as 'cyara.minorthreshold.1'
,[MajorThreshold] as 'cyara.majorthreshold.1'
,[MinPause] as 'cyara.minpausetime.1'
,[MaxPause] as 'cyara.maxpausetime.1'
,[MajorConfidenceLevel] as 'Cyara.MajorConfLevel.1'
,[MinorConfidenceLevel] as 'Cyara.MinorConfLevel.1'
,[PostSpeechSilenceTimeout] as 'cyara.psst.0'
FROM [STEP]
WHERE TestCaseId = @TestCaseId
AND Type = @Type
@
for the variable name is the syntax for MS SQL
Server.
Test case parameters
A number of predefined attributes of the currently executing Test Case are sent with the request to your service. These are detailed below in the section titled Test Case Attributes.
SELECT TOP 10
[Expect]
,[Reply]
,[MinorThreshold] as 'cyara.minorthreshold.1'
,[MajorThreshold] as 'cyara.majorthreshold.1'
,[MinPause] as 'cyara.minpausetime.1'
,[MaxPause] as 'cyara.maxpausetime.1'
,[MajorConfidenceLevel] as 'Cyara.MajorConfLevel.1'
,[MinorConfidenceLevel] as 'Cyara.MinorConfLevel.1'
,[PostSpeechSilenceTimeout] as 'cyara.psst.0'
FROM [STEP]
WHERE Reply = @Step_2_ReplyText
This will pass in the value of the reply text from Test Step 2 into the script at runtime.
Calling your query from a Test Case
From the Edit or Create Test Case screen, you can define a Data Driven Dynamic Service. In the area provided, type the URL into this service's address, for example:
http://mysite:8081/jsonfeed.ashx?script=TestParams&intTestCaseID=14
Use the script parameter to select which of the SQL files to invoke.
Returning results from multiple scripts
It is possible to run multiple scripts per Test Case and have the results appended together before being returned to the Voice Scheduler. Using this feature in combination with overriding the connection per script allows you to query results from a number of different databases.
http://mysite:8081/jsonfeed.ashx?script=TestParams1&script=TestParams2&script=TestParams3&intTestCaseID=14
Test Case attributes
When your Test Case is executed by the Cyara Platform and this service is called to generate test parameters, certain fields of the Test Case will be sent with the request and made available to your scripts.
- @TestCase_TestCaseName
- @TestCase_FolderPath
- @TestCase_Description
- @TestCase_Notes
- @TestCase_Steps
- @Step_0_Description
- @Step_0_ExpectedText
- @Step_0_ReplyText
@
character is the variable prefix character for
MSSQL.
The Step number (0) can be used to index into the Steps collection of your Test Case.
The parameters can be accessed from your SQL scripts by including the names in the query.
SELECT * FROM MyTestCases
WHERE Name = @TestCase_TestCaseName
SELECT * FROM MyTestSteps
WHERE StepNo = 5
AND ExpectedText = @Step_5_ExpectedText
Comments
0 comments
Please sign in to leave a comment.