automated tests using Rest-assured

This commit is contained in:
2025-05-16 02:05:04 +03:00
commit ea0c2c9f7e
3 changed files with 307 additions and 0 deletions

96
pom.xml Normal file
View File

@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- Основная информация о проекте -->
<groupId>ru.otus</groupId>
<artifactId>petstore</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>petstore</name>
<!-- Глобальные свойства проекта -->
<properties>
<!-- Используем Java 24 -->
<maven.compiler.source>24</maven.compiler.source>
<maven.compiler.target>24</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Версии зависимостей -->
<restassured.version>4.5.1</restassured.version>
<junit.jupiter.version>5.9.1</junit.jupiter.version>
</properties>
<!-- Зависимости проекта -->
<dependencies>
<!-- Rest-assured для работы с REST API с исключением транзитивой зависимости commons-codec -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${restassured.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Явное подключение обновлённой, безопасной версии commons-codec -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
<scope>test</scope>
</dependency>
<!-- JSON-парсинг через Rest-assured -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-path</artifactId>
<version>${restassured.version}</version>
<scope>test</scope>
</dependency>
<!-- JUnit Jupiter API для написания автотестов (включает ExtensionContext и TestWatcher) -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<!-- JUnit Jupiter Engine для выполнения тестов -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<!-- Конфигурация сборки проекта -->
<build>
<plugins>
<!-- Maven Compiler Plugin для компиляции проекта с поддержкой Java 24 -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<!-- Maven Surefire Plugin для запуска тестов -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>
</project>