There are several things to know about working with data sources while you are creating data-driven test cases.
- You must have an existing data source with tables and columns defined before you data drive a test case. However, the data
source does not need to contain rows of data. You cannot use the
Data Driven Workflow to create data sources or databases.
- If you have a table in your data source that has a long name (greater than 25 characters), all of the name may not be visible
Find and Replace menu bar in the
4Test Editor. You may find it helpful to change the size of the menu bar to display more of your table name.
- You cannot change to a different data source once you have started to find and replace values in a script. If you do, you
will have problems with prior replacements. If you want to change your data source, you should create a new data-driven script
- If you are working with a data source that requires a user name and password, you can add the username and password to the
connect string in the
.g.t file. The first example below shows how SQL Server requires a userid and password.
[ ] STRING gsDSNConnect = "DSN=USER.SQL.DSN;UID=SA;PWD=sesame;" where UID=<your user ID> ("SA" in the example above) and where
PWD=<your password> ("sesame" in the example above). On the other hand, the example below shows how the Connect string for a MS Excel DSN does
not require user IDs or passwords:
[ ] STRING gsDSNConnect = "DSN=Silk DDA Excel;DBQ=C:\TestExcel.xls;UID=;PWD="
- You can choose to run with a sample record if the table is empty; however, this record is not inserted into the database.
The sample record is created by
Silk Test Classic when it replaces values from the test case by the table and columns in your database.
- Real numbers should be stored as valid
4Test Real numbers with format:
[-]ddd.ddd[e[-]ddd], even though databases such as MS Excel allow a wider range of formats – for example, currencies and fractions.
- There are no restrictions on how you name your tables and columns within your data source.
Silk Test Classic automatically removes spaces, and converts dollar signs and other special characters to underscores when it creates the sample
record and writes other code to your data-driven test case.
Silk Test Classic handles MS Excel and MS Access table names without putting quotation marks around them. This means that your table and column
names will look familiar when you go to find and replace values.
- If you encounter the error "ODBC Excel Driver numeric field overflow" while running a test case, check the Excel workbook
that you are using as your data source. You may have some columns that are defined as STRING columns but contain numeric values
in some of the rows. If you have a column that you want to treat as numeric strings rather than as numbers, either format
the column as 'Text' or begin the number strings with a single-quote character. For example: '1003 instead of: 1003
- If modifying data sources in an existing Excel data sheet, use the
remove column option to delete any data to be removed, as simply deleting from the cell, using clear contents, or copy/pasting content
will not register correctly with the DDS file in
Silk Test Classic and may lead to a data source mismatch error:
*** Error: Incompatible types -- Number of list elements exceeds number of fields.
Formatting MS Excel worksheets for use as a data source
Use the 'General' format for the columns of your worksheets. Here are specific suggestions for column formats based on the
intended data type of the column:
| Intended Data Type of Column
|| Excel Column Format
|| If the column contains only text, no numbers, dates or booleans, then apply the 'General' format. If the column contains
text and numbers, then you can still apply the 'General' format if you begin the number strings with a single-quote character.
For example: '1003 instead of: 1003. Otherwise, apply the 'Text' format.
| INTEGER or REAL
|| ‘General' or 'Number' format.
|| ‘General' format. Use only the values TRUE and FALSE.
|| ‘Custom' format: yyyy-mm-dd hh:mm:ss. That agrees with the ISO format used by
Silk Test Classic DATETIME values.