Highlighted
Eregion Absent Member.
Absent Member.
1662 views

Question about automating querys to DDBB

Jump to solution

Hi,

We are working on a test case that require to perform some DDBB querys (inserts and selects for input and verification of results) against an Oracle DDBB and we are evaluating three diferent approachs:

1. Integrating the DDBB connection directly into SilkTest through and ODBC driver and code everything directly in the SilkTest IDE.

2. Creating an external script the query the DDBB and log the results into a file, so we can call the script from SilkTest and then parse the log file to extract the results and evaluate them once they are in variables.

3. Using a graphical application such as SQLDeveloper, SQuirrel, or whatever that is already configured to use that DDBB and automate with SilkTest the steps to paste the query in the required fields, pressing buttons, etc, and finally extracting the results from the results window and storing them into SilkTest internal variables or data structures for later evaluation.

 

We don't have experience in the first approach but we think it could be the best option for better control of the execution and evaluation.

The second one is almost inmediate for us to code the script, but the problem comes when we have to parse the log files that sqlplus outputs.

The 3rd option could be also easy to implement, but we may find problems if SilkTest fails to recognize the 3th-party app (sqldeveloper, etc) components, buttons etc.

 

So the question is, which of these approaches do you recommend to us? In case you think that using an ODBC driver directly from SilkTest, and coding the setup and sql calls to it in the test case, is the best option, could you please give us directions on wich component/tool should we use and if there is any place with documentation for doing this by ourselves?

 

Thank you very much in advance.

Tags (3)
0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

RE: Question about automating querys to DDBB

Jump to solution

Approach 1. Connecting and querying an Oracle Database directly is possible with the SilkTest Classic and Workbench Clients; and can also be implemented in Java or .Net via the Silk4J and Silk4Net Plugins.

The Classic Help Documentation contains full details on the DB_Tester functions available for querying an ODBC Data Source - with an example showing how to use all of the available functions. Note that queries can be passed directly via the DB_ExecuteSQL command; or the method can be used to execute Stored Procedures within Oracle. Please also see the following kb articles for some further examples:

> http://kb.microfocus.com/article.aspx?article=21231&p=6

> http://kb.microfocus.com/article.aspx?article=22122&p=6

 

SilkTest Workbench: Although it is not possible to connect to any Database in a Visual Test; this can be done in .Net Scripts, which can also be called and executed from within a Visual Test. The connection method used in .Net depends on the type of Data Source(ODBC or SQL Server); however both connection methods are documented in the following kb article:

> http://kb.microfocus.com/article.aspx?article=34175&p=6


Approach 2: Creating an external script that queries the DB and logs the results into a file; so we can call the script from SilkTest and then parse the log file to extract the results, and evaluate them once they are in variables.

This would perhaps be the least preferred option; due to the additional layer involved in launching an external script to connect and query the Oracle Database. This can be done from within any SilkTest Client; but technically the approach is still possible and SilkTest provides a number of File manipulation methods, that can be used to extract and then verify Data from the generated log files.

 

Approach 3: As you suggested the level of object recognition SilkTest has of controls in the application used to connect, and query the Database; will determine just how straightforward this solution is to implement. But I have looked at Oracle SQL Developer in-house with SilkTest Classic Open Agent, and found that recognition of the Java controls was excellent; the recorded scripts replayed successfully without modification. I would expect very similar results with the Workbench, Silk4J and Silk4Net since they are rely on the Open Agent. 

 

Conclusion: Its really your own prerogative which option you go with since they are all possible with SilkTest. but I don't see any real benefit to the additional layer in option 2 (calling an external script to query the Database); as this can be accomplished directly in any of the SilkTest clients. However the very high level of recognition the Open Agent has for the controls in SQL Developer; may provide the easiest and most straightforward solution, and you would still have the option to use any SilkTest Client available.

 

View solution in original post

0 Likes
1 Reply
Micro Focus Expert
Micro Focus Expert

RE: Question about automating querys to DDBB

Jump to solution

Approach 1. Connecting and querying an Oracle Database directly is possible with the SilkTest Classic and Workbench Clients; and can also be implemented in Java or .Net via the Silk4J and Silk4Net Plugins.

The Classic Help Documentation contains full details on the DB_Tester functions available for querying an ODBC Data Source - with an example showing how to use all of the available functions. Note that queries can be passed directly via the DB_ExecuteSQL command; or the method can be used to execute Stored Procedures within Oracle. Please also see the following kb articles for some further examples:

> http://kb.microfocus.com/article.aspx?article=21231&p=6

> http://kb.microfocus.com/article.aspx?article=22122&p=6

 

SilkTest Workbench: Although it is not possible to connect to any Database in a Visual Test; this can be done in .Net Scripts, which can also be called and executed from within a Visual Test. The connection method used in .Net depends on the type of Data Source(ODBC or SQL Server); however both connection methods are documented in the following kb article:

> http://kb.microfocus.com/article.aspx?article=34175&p=6


Approach 2: Creating an external script that queries the DB and logs the results into a file; so we can call the script from SilkTest and then parse the log file to extract the results, and evaluate them once they are in variables.

This would perhaps be the least preferred option; due to the additional layer involved in launching an external script to connect and query the Oracle Database. This can be done from within any SilkTest Client; but technically the approach is still possible and SilkTest provides a number of File manipulation methods, that can be used to extract and then verify Data from the generated log files.

 

Approach 3: As you suggested the level of object recognition SilkTest has of controls in the application used to connect, and query the Database; will determine just how straightforward this solution is to implement. But I have looked at Oracle SQL Developer in-house with SilkTest Classic Open Agent, and found that recognition of the Java controls was excellent; the recorded scripts replayed successfully without modification. I would expect very similar results with the Workbench, Silk4J and Silk4Net since they are rely on the Open Agent. 

 

Conclusion: Its really your own prerogative which option you go with since they are all possible with SilkTest. but I don't see any real benefit to the additional layer in option 2 (calling an external script to query the Database); as this can be accomplished directly in any of the SilkTest clients. However the very high level of recognition the Open Agent has for the controls in SQL Developer; may provide the easiest and most straightforward solution, and you would still have the option to use any SilkTest Client available.

 

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.