вторник, 15 мая 2018 г.

AQA: Java - Простой пример работы с Property файлами в Java

Property файлы присутствуют практически в каждом проекте, и сейчас я вам покажу простой пример их использования, а также расскажу, зачем они и где используются.

Шаг 0. Создание проекта

Начнем с того что создадим простой Maven проект, указав название и имя пакета:

prop_1

Структура, которая получится в конце проекта довольно таки простая.


Как видите у нас только два файла, первый – Main.java, а второй – config.properties.


четверг, 3 мая 2018 г.

AQA: Selenium - WebDriver - Database Testing using Selenium: Step by Step Guide


Selenium Webdriver is limited to Testing your applications using Browser. To use Selenium Webdriver for Database Verification you need to use the JDBC ("Java Database Connectivity").
JDBC (Java Database Connectivity) is a SQL level API that allows you to execute SQL statements. It is responsible for the connectivity between the Java Programming language and a wide range of databases. The JDBC API provides the following classes and interfaces
  • Driver Manager
  • Driver
  • Connection
  • Statement
  • ResultSet
  • SQLException
In order to test your Database using Selenium, you need to observe the following 3 steps
1. Make a connection to the Database
2. Send Queries to the Database
3. Process the results
Database Testing using Selenium: Step by Step Guide

1) Make a connection to the Database

In order to make a connection to the database the syntax is
DriverManager.getConnection(URL, "userid", "password" )
Here,
  • Userid is the username configured in the database
  • Password of the configured user
  • URL is of format jdbc:< dbtype>://ipaddress:portnumber/db_name"
  • <dbtype>- The driver for the database you are trying to connect. To connect to oracle database this value will be "oracle"
    For connecting to database with name "emp" in MYSQL URL will bejdbc:mysql://localhost:3036/emp
And the code to create connection looks like
Connection con = DriverManager.getConnection(dbUrl,username,password);
You also need to load the JDBC Driver using the code
Class.forName("com.mysql.jdbc.Driver");

2) Send Queries to the Database

Once connection is made, you need to execute queries.
You can use the Statement Object to send queries.
Statement stmt = con.createStatement();   
Once the statement object is created use the executeQuery method to execute the SQL queries
stmt.executeQuery(select *  from employee;);

3) Process the results

Results from the executed query are stored in the ResultSet Object.
Java provides loads of advance methods to process the results. Few of the methods are listed below
Database Testing using Selenium: Step by Step Guide

 Example of Database Testing with Selenium

SEO: Эксперимент: как Яндекс и Google учитывают ключевые слова в URL

Эксперимент: как Яндекс и Google учитывают ключевые слова в URL Эксперимент: как Яндекс и Google учитывают ключевые слова в URL Дата пу...