"how to do database testing in your framework" Code Answer's
You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "how to do database testing in your framework" answered properly. Developers are finding an appropriate answer about how to do database testing in your framework related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like how to do database testing in your framework. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on how to do database testing in your framework.
how to do database testing in your framework
For database testing For manual I use Oracle sql developer for producing SQL
queries
FOR AUTOMATION; I use JDBC library to integrate
java by getting a CONNECTION from oracle database
then creating STATEMENTS using SQL queries and
then storing the data into a RESULTSET object.
I use java data structures to use store data inside and
compare them
and since I'm using DATA DRIVEN and CUCUMBER
BDD framework, all of these tests are stored inside feature
files
I have RUNNER classes that helps generate codes from
FEATURE FILE and implement them into a file called b
I also have HOOK class that implements my codes that
run before and after all my tests - this is where I invoke my
TAKESCREENSHOT interface which triggers when I use
scenario interface (when scenario fails)
It takes a picture when you are on the step that failed
StepDefinition - this is where I stored my codes that
based on gherkin language expected value DDT
If I'm working with small amounts of test data, I'm
going to operate with scenario outlines, this where I create
examples and store data using pipeline
In my automation framework I had database utility class
which handles everything related to setting up
connections, closing connections, getting data from
database and storing results from database into
different collections arrays etc. So that I can easily work with
it.
And I use it in my framework by
using Connection interface, with getConnection method(url,username, password)
I’m keeping url, username, password in the configuration
file
url starts with oracle or postgresql, mysql...
url:"jdbc:oracle:thin:@url:1521:xe";
Syntax:
Connection connection = DriverManager.getConnection(url,
username, password) //throws SQL exception:checked
exception
Statement statement = connection.CreateStatement()
//throws SQL exception: checked exception
ResultSet resultSet = statement.executeQuery("Query")
resultSet.getObject/String/int(index)
ResultSetMetaData
resultSetMetaData=resultSet.getMetaData() columns
First,
getConnection -> connection.CreateStatement -> Resultset
resultset
ResultSetMetaData rsm = resultSet.getMetaData();
I can retrieve the column names and counts with the help of
rsm.getColumnName(i)/getColumnCount(),
Make sure you start your loop from 1 until <= last value
How did you do DB testing in your framework?
List <Map<String, String>> list = new ArrayList<>();
while(resultset.next()){
Map<String, String> map = new HashMap<>();
for(i = 1; i<= rsm.getColoumnCount;i++ ){
map.put(rsm.getColoumnName(i), result.getString(i))
}
list.add(map);
}
sout(list.get(3).get("key"))
All those coders who are working on the Whatever based application and are stuck on how to do database testing in your framework can get a collection of related answers to their query. Programmers need to enter their query on how to do database testing in your framework related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about how to do database testing in your framework for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of how to do database testing in your framework while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "how to do database testing in your framework". Visit this developer's friendly online web community, CodeProZone, and get your queries like how to do database testing in your framework resolved professionally and stay updated to the latest Whatever updates.