This repository was archived by the owner on Oct 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Link to Dockerfile #75
Open
OneginES
wants to merge
25
commits into
autoschool:master
Choose a base branch
from
OneginES:docker
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
0002484
Two web autotests
OneginES d15a93a
Add test for choose another city
OneginES 2911e2a
Fix some bugs...
OneginES 7a275c0
Fix code according to comments
OneginES 34245ce
Rewrite part of code according to comments
OneginES 3b25d1d
Change maven encoding to UTF-8.
OneginES f94c32d
Merge with init for TestPalma
OneginES dbff25c
Add some new tests, some tests and steps refactoring.
OneginES 66e302d
Add step for waiting until changing element is ready.
OneginES eeb3d13
Add some tests. Add some objects in pageObject.
OneginES fba2f18
Add some tests. Add some steps. Add some objects in pageObject.
OneginES 3eee981
Add "import ru.yandex.qatools.allure.annotations.TestCaseId"
OneginES d465cdd
Change logic construction to CITY2_BEGIN constant.
OneginES 70b4812
Test class is divided into two classes: smoke and regression.
OneginES 4ca431a
Correction of mistakes
OneginES 5690d0a
Add clickOn() for several times.
OneginES d00ccdc
everyItem is added
OneginES ae32181
New module. Add dependencies. Add tests from presentation.
OneginES 14c98f3
Refactor project structure. Add two autotests for API.
OneginES 343dc7d
Merge with DB
OneginES 7f9112f
API + DB Tests
OneginES dbcab3f
Refactoring according to @lanwen and @bluedogseyes reviews.
OneginES d3f3631
rm apiData to apidata
OneginES 3260326
Link to Dockerfile
OneginES 6f8d2a0
Merge two classes in one WebTest class.
OneginES File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| # Practice of automation school 2016 | ||
|
|
||
| See all info in repo [autoschool/autoschool.github.io](https://github.com/autoschool/autoschool.github.io) | ||
|
|
||
| See Dockerfile in repo [OneginES/Docker](https://github.com/OneginES/Docker) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| <?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <parent> | ||
| <artifactId>school-2016</artifactId> | ||
| <groupId>ru.qatools.school</groupId> | ||
| <version>1.0-SNAPSHOT</version> | ||
| </parent> | ||
|
|
||
| <artifactId>api-tests-module</artifactId> | ||
|
|
||
| <name>API Module</name> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>ru.qatools.school</groupId> | ||
| <artifactId>steps-module</artifactId> | ||
| <version>1.0-SNAPSHOT</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>ru.qatools.school</groupId> | ||
| <artifactId>dbclient-module</artifactId> | ||
| <version>${project.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>ru.yandex.qatools.matchers</groupId> | ||
| <artifactId>collection-matchers</artifactId> | ||
| <version>1.3</version> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| <reporting> | ||
| <excludeDefaults>true</excludeDefaults> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>ru.yandex.qatools.allure</groupId> | ||
| <artifactId>allure-maven-plugin</artifactId> | ||
| <version>2.0</version> | ||
| </plugin> | ||
| </plugins> | ||
| </reporting> | ||
| </project> |
148 changes: 148 additions & 0 deletions
148
api-tests-module/src/test/java/ru/qatools/school/apitests/RestAssuredTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| package ru.qatools.school.apitests; | ||
|
|
||
| import com.jayway.restassured.builder.RequestSpecBuilder; | ||
| import com.jayway.restassured.specification.RequestSpecification; | ||
| import org.apache.http.HttpStatus; | ||
| import org.junit.After; | ||
| import org.junit.Before; | ||
| import org.junit.Rule; | ||
| import org.junit.Test; | ||
| import ru.qatools.school.DbClient; | ||
| import ru.qatools.school.apidata.SuggestResp; | ||
| import ru.qatools.school.apidata.WeatherResp; | ||
| import ru.qatools.school.tp.TPInformerRule; | ||
| import ru.yandex.qatools.allure.annotations.Features; | ||
| import ru.yandex.qatools.allure.annotations.TestCaseId; | ||
| import ru.yandex.qatools.allure.annotations.Title; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| import static com.jayway.restassured.RestAssured.given; | ||
| import static java.util.Arrays.asList; | ||
| import static org.hamcrest.Matchers.*; | ||
| import static org.junit.Assert.assertThat; | ||
| import static ru.yandex.qatools.matchers.collection.HasSameItemsAsListMatcher.hasSameItemsAsList; | ||
|
|
||
| /** | ||
| * @author onegines (Eugene Kirienko) | ||
| */ | ||
| public class RestAssuredTest { | ||
|
|
||
| private static final String MAIN_PAGE = "http://weather.lanwen.ru/"; | ||
| private static final String BASE_PATH = "api"; | ||
|
|
||
| private static final String CITYNAME = "Chita"; | ||
| private static final String CITYNAMEBEGIN = "Saint"; | ||
| private static final String CITYNAMEPART = "ain"; | ||
|
|
||
| private RequestSpecification reqSpec; | ||
|
|
||
| private DbClient dbClient; | ||
|
|
||
| @Rule | ||
| public TPInformerRule tms = new TPInformerRule("onegines"); | ||
|
|
||
| @Before | ||
| public void init() { | ||
| dbClient = new DbClient(); | ||
|
|
||
| reqSpec = new RequestSpecBuilder().build() | ||
| .baseUri(MAIN_PAGE) | ||
| .basePath(BASE_PATH); | ||
| } | ||
|
|
||
| @After | ||
| public void close() { | ||
| dbClient.close(); | ||
| } | ||
|
|
||
| @Test | ||
| @Features("Suggest") | ||
| @Title("Должны получить код 400 после отправки запроса саджеста без параметров") | ||
| @TestCaseId("53") | ||
| public void shouldGetErrorCode400AfterSendNoQueryToSuggest() throws Exception { | ||
| given().spec(reqSpec) | ||
| .get("suggest") | ||
| .then().assertThat() | ||
| .statusCode(HttpStatus.SC_BAD_REQUEST); | ||
| } | ||
|
|
||
| @Test | ||
| @Features("Suggest") | ||
| @Title("Должны получить список городов, содержащих в названии строку из запроса") | ||
| @TestCaseId("42") | ||
| public void shouldGetSuggestsContainsPartOfName() throws Exception { | ||
| given().spec(reqSpec) | ||
| .param("query", CITYNAMEBEGIN) | ||
| .get("suggest") | ||
| .then().assertThat() | ||
| .statusCode(HttpStatus.SC_OK) | ||
| .and().body("name", everyItem(containsString(CITYNAMEBEGIN))); | ||
| } | ||
|
|
||
| @Test | ||
| @Features("Suggest") | ||
| @Title("Должны совпадать списки (от API и DB) саджестов, содержащих в названии города строку из запроса") | ||
| @TestCaseId("75") | ||
| public void shouldMatchSuggestsFromApiAndDb() throws Exception { | ||
|
|
||
| List<SuggestResp> respApi = asList( | ||
| given().spec(reqSpec) | ||
| .param("query", CITYNAMEPART) | ||
| .expect().statusCode(HttpStatus.SC_OK) | ||
| .get("suggest") | ||
| .as(SuggestResp[].class) | ||
| ); | ||
|
|
||
| List<SuggestResp> respDb = dbClient.getSuggestCitiesByNamePart(CITYNAMEPART); | ||
|
|
||
| assertThat("Списки из API и DB должны совпадать", respApi, hasSameItemsAsList(respDb)); | ||
|
|
||
| } | ||
|
|
||
| @Test | ||
| @Features("Weather") | ||
| @Title("Должны получить погоду в городе с названием, указанным в запросе") | ||
| @TestCaseId("55") | ||
| public void shouldGetWeatherWithCityName() throws Exception { | ||
|
|
||
| WeatherResp resp = | ||
| given().spec(reqSpec) | ||
| .param("city", CITYNAME) | ||
| .expect().statusCode(HttpStatus.SC_OK) | ||
| .get("weather") | ||
| .as(WeatherResp.class); | ||
|
|
||
| assertThat("Неправильный город", resp.getCity(), is(CITYNAME)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| } | ||
|
|
||
| @Test | ||
| @Features("Weather") | ||
| @Title("Должны получить погоду в городе с названием '0'") | ||
| @TestCaseId("60") | ||
| public void shouldGetWeatherWithCityName0() throws Exception { | ||
|
|
||
| WeatherResp resp = | ||
| given().spec(reqSpec) | ||
| .param("city", "0") | ||
| .expect().statusCode(HttpStatus.SC_OK) | ||
| .get("weather") | ||
| .as(WeatherResp.class); | ||
|
|
||
| assertThat("Неправильный город", resp.getCity(), is("0")); | ||
|
|
||
| } | ||
|
|
||
| @Test | ||
| @Features("Weather") | ||
| @Title("Должны получить код 400 после отправки запроса погоды без параметров") | ||
| @TestCaseId("65") | ||
| public void shouldGetErrorCode400AfterSendNoQueryToWeather() throws Exception { | ||
| given().spec(reqSpec) | ||
| .get("weather") | ||
| .then().assertThat() | ||
| .statusCode(HttpStatus.SC_BAD_REQUEST); | ||
| } | ||
|
|
||
| } | ||
109 changes: 109 additions & 0 deletions
109
api-tests-module/src/test/java/ru/qatools/school/apitests/RetrofitTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| package ru.qatools.school.apitests; | ||
|
|
||
| import org.apache.http.HttpStatus; | ||
| import org.junit.After; | ||
| import org.junit.Before; | ||
| import org.junit.Rule; | ||
| import org.junit.Test; | ||
| import retrofit2.Response; | ||
| import retrofit2.Retrofit; | ||
| import retrofit2.converter.gson.GsonConverterFactory; | ||
| import ru.qatools.school.DbClient; | ||
| import ru.qatools.school.apidata.SuggestResp; | ||
| import ru.qatools.school.apidata.WeatherApi; | ||
| import ru.qatools.school.apidata.WeatherResp; | ||
| import ru.qatools.school.tp.TPInformerRule; | ||
| import ru.yandex.qatools.allure.annotations.Features; | ||
| import ru.yandex.qatools.allure.annotations.Title; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.List; | ||
|
|
||
| import static org.hamcrest.Matchers.*; | ||
| import static org.junit.Assert.assertThat; | ||
| import static ru.yandex.qatools.matchers.collection.HasSameItemsAsListMatcher.hasSameItemsAsList; | ||
|
|
||
| /** | ||
| * @author onegines (Eugene Kirienko) | ||
| */ | ||
| public class RetrofitTest { | ||
|
|
||
| private static final String MAIN_PAGE = "http://weather.lanwen.ru/"; | ||
| private static final String CITYNAMEBEGIN = "Saint"; | ||
| private static final String CITYNAMEPART = "ain"; | ||
|
|
||
| private WeatherApi weatherApi; | ||
| private DbClient dbClient; | ||
|
|
||
| private Retrofit retrofit = new Retrofit.Builder() | ||
| .baseUrl(MAIN_PAGE) | ||
| .addConverterFactory(GsonConverterFactory.create()) | ||
| .build(); | ||
|
|
||
| @Rule | ||
| public TPInformerRule tms = new TPInformerRule("onegines"); | ||
|
|
||
| @Before | ||
| public void init() { | ||
| weatherApi = retrofit.create(WeatherApi.class); | ||
| dbClient = new DbClient(); | ||
| } | ||
|
|
||
| @After | ||
| public void close() { | ||
| dbClient.close(); | ||
| } | ||
|
|
||
| @Test | ||
| @Features("Suggest") | ||
| @Title("Должны получить код 400 после отправки запроса саджеста без параметров") | ||
| //@TestCaseId("53") | ||
| public void shouldGetErrorCode400AfterSendNoQueryToSuggest() throws IOException { | ||
|
|
||
| Response<List<SuggestResp>> resp = weatherApi.suggest().execute(); | ||
|
|
||
| assertThat("Неправильный код ответа", resp.code(), is(HttpStatus.SC_BAD_REQUEST)); | ||
|
|
||
| } | ||
|
|
||
| @Test | ||
| @Features("Suggest") | ||
| @Title("Должны получить список городов, содержащих в названии строку из запроса") | ||
| //@TestCaseId("42") | ||
| public void shouldGetSuggestsContainsPartOfName() throws IOException { | ||
|
|
||
| Response<List<SuggestResp>> resp = weatherApi.suggest(CITYNAMEBEGIN).execute(); | ||
|
|
||
| assertThat("Request status different from expected", resp.code(), is(HttpStatus.SC_OK)); | ||
| assertThat("Все города должны содержать строку из запроса", resp.body(), everyItem(hasProperty("name", containsString(CITYNAMEBEGIN)))); | ||
|
|
||
| } | ||
|
|
||
| @Test | ||
| @Features("Suggest") | ||
| @Title("Должны совпадать списки (от API и DB) саджестов, содержащих в названии города строку из запроса") | ||
| //@TestCaseId("75") | ||
| public void shouldMatchSuggestsFromApiAndDb() throws IOException { | ||
|
|
||
| Response<List<SuggestResp>> respApi = weatherApi.suggest(CITYNAMEPART).execute(); | ||
| List<SuggestResp> respDb = dbClient.getSuggestCitiesByNamePart(CITYNAMEPART); | ||
|
|
||
| assertThat("Неправильный код ответа", respApi.code(), is(HttpStatus.SC_OK)); | ||
| assertThat("Списки из API и DB должны совпадать", respApi.body(), hasSameItemsAsList(respDb)); | ||
|
|
||
| } | ||
|
|
||
| @Test | ||
| @Features("Weather") | ||
| @Title("Должны получить код 400 после отправки запроса погоды без параметров") | ||
| //@TestCaseId("65") | ||
| public void shouldGetErrorCode400AfterSendNoQueryToWeather() throws IOException { | ||
|
|
||
| Response<WeatherResp> resp = weatherApi.weather().execute(); | ||
|
|
||
| assertThat("Неправильный код ответа", resp.code(), is(HttpStatus.SC_BAD_REQUEST)); | ||
|
|
||
| } | ||
|
|
||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,5 +53,4 @@ | |
| </plugin> | ||
| </plugins> | ||
| </reporting> | ||
|
|
||
| </project> | ||
36 changes: 0 additions & 36 deletions
36
commons-module/src/test/java/ru/qatools/school/webtests/WeatherWebTest.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/yandex-qatools/matchers-java/tree/master/collection-matchers