Database-Backed Seed Data

Document created by Chris Sommerstad Employee on Jul 20, 2017Last modified by Jijius Jabez on Aug 10, 2017
Version 2Show Document
  • View in full screen mode

CloudTest supports database-backed Seed Data, which enables users to execute a database query from within a Seed Data Repository object in order to utilize retrieved query data as seed data. When you run a load test, this query to the database will occur once (and only once) to make sure you have 'fresh' data for the loadtest.  Users wishing to interact with databases in a more dynamic way should investigate CloudTest's Direct to Database Testing feature.

Once retrieved, the database-backed seed data can be utilized in your test just as any other seed data can be. For more about this important topic, refer to any of the following CloudLink, KnowledgeBase topics:

Users can setup a Seed Data: Repository database connection using the Seed Data Wizard and the following steps. 

  1. Launch the Seed Data Wizard using Central > Seed Data, New.

The Seed Data Wizard's Name, Description, and Method page appears.

  1. To define a JDBC connection, select the Execute a database query button, and then click Next.

The Definition and Edit page appears. You can opt to enter the pertinent information using either the Basic or Advanced tab of the Seed Data Wizard.

  • Use the Basic tab if you'd like the Seed Data Wizard to construct the JDBC URL for you. The resulting URL will be based on the information you provide.
  • Use the Advanced tab if you are a power user and already know the JDBC URL to use. Additionally, note that the Advanced tab also accepts additional query parameters that advanced users may want to provide in some cases. If you are such a user, you can paste the pertinent JDBC URL into the Advanced tab JDBC URL field, and then move on to defining the Seed Data retrieval query to use (see Step 9 below).

  1. For basic users, select the type of RDBMS to use.

These are limited to the currently supported databases PostgreSQL, Oracle, and SQL Server. The currently supported RDBMS versions are:

  • Oracle (versions: 11.2.0, 11.1.0, 10.2.0, 10.1.0, 9.2.0, 9.0.1)
  • Microsoft SQL Server (versions: SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, SQL Server 2005, SQL Azure)
  • PostgreSQL (versions: 7.2 or newer)
  1. Enter the host name of your RDBMS. For example, localhost, if the database resides on the same machine. Otherwise, specify it by IP address or domain.
  2. Enter the port in use for the given host name. This is database specific. For example, 5432 for a default PostgreSQL installation.
  3. Enter the Catalog name. For example, soasta_maestro_database_testing.
  4. Enter the RDBMS User Name and Password. In our example, we are using the PostgreSQL username SOASTA_DOC.
  5. Check Use SSL, if required for your RDBMS connection.

As noted above, the Basic tab will construct the JDBC URL for your database type based on the information that you provided in the steps above.

Note that the following syntaxes are used for the given database type:

PostgreSQL database requires the following Database URL format:

jdbc:postgresql://<database_server_host>:<port_number>/<database_name>

Note: Refer to the PostgreSQL online documentation for more details.

Microsoft SQL Server database requires the following Database URL format:

jdbc:sqlserver://[databaseServerHost[\databaseInstanceName][:portNumber]][;<property>=value[;<property=value>]] <property=value>]]

The database name is specified by the property "databaseName".

Note: Refer to the Microsoft online documentation for more details.

An Oracle database requires the following Database URL format:

jdbc:oracle:thin:@:<port_number>:<database_name>

Note: Refer to the Oracle database documentation for more information.

  1. Finally, enter the Seed Data retrieval query. This query should get the data to use as seed data. Some common examples include:

SELECT * FROM serverclass

Or,

SELECT * FROM serverclass order by id

Or,

 

SELECT * FROM __seed_data__ where column_1 like 'Seed Data Object 005D%;'

  1. After entering your Seed Data retrieval query, click the Test button to execute your query. When you do so, if the query is successful, the results of your query are posted to the table below the Test button (as shown below).

The last example above is used in the following examples.

For the Basic tab:

For the Advanced tab:

 

Attachments

    Outcomes