Skip to content
This repository has been archived by the owner on Oct 18, 2018. It is now read-only.

Readme.md #66

Open
wants to merge 83 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
ba04e03
init second practice
merkushevio Apr 14, 2016
4f562d1
Add test for main page
merkushevio Apr 17, 2016
e2a3e1e
Add test autocomplite
merkushevio Apr 17, 2016
11f687a
change constants from public to private
merkushevio Apr 17, 2016
5993651
edit MainPage
merkushevio Apr 18, 2016
68164e4
edit WidgetTitle, DefaultSteps
merkushevio Apr 18, 2016
36bb97f
create class with methods for tests
merkushevio Apr 19, 2016
1455b21
edit add widget test, work version
merkushevio Apr 20, 2016
bb64de9
refactor tests
merkushevio Apr 20, 2016
528b4f9
add to tp
merkushevio Apr 20, 2016
1c897c8
tp-rule
lanwen Apr 19, 2016
f24f4d2
tp log errors
merkushevio Apr 20, 2016
da1ca42
correct config test for test palm
merkushevio Apr 20, 2016
e0e05eb
refactor autocomplete
merkushevio Apr 20, 2016
e3d2abb
add test for view
merkushevio Apr 20, 2016
b328619
test cases and skipped test with bug
merkushevio Apr 21, 2016
5cc388e
refactor tests
merkushevio Apr 22, 2016
4457990
initial
merkushevio Apr 7, 2016
28a0f1b
initial
merkushevio Apr 7, 2016
7dabb89
commit
merkushevio Apr 7, 2016
689298f
commit
merkushevio Apr 7, 2016
e87eb76
commit
merkushevio Apr 7, 2016
6b55ab8
First test complete
merkushevio Apr 7, 2016
525baab
First test second version
merkushevio Apr 8, 2016
7f47184
First test second version
merkushevio Apr 8, 2016
31ed5a7
Added commons-module and tests for user().goTo(place)
gladnik Apr 7, 2016
8a32db8
refactor tests, create new file WidgetSteps
merkushevio Apr 22, 2016
5e555c3
pom files restore
merkushevio Apr 22, 2016
8d0b2f8
refactor test, add test view elements widget
merkushevio Apr 22, 2016
5da584a
full test completed
merkushevio Apr 22, 2016
59077dd
refactor tests, add WidgetSteps, refactor MainPageMethods
merkushevio Apr 26, 2016
68058bf
enable Rule for TestPalm
merkushevio Apr 26, 2016
7164bcc
init second practice
merkushevio Apr 14, 2016
68dd115
Add test for main page
merkushevio Apr 17, 2016
519496d
Add test autocomplite
merkushevio Apr 17, 2016
d4500ea
change constants from public to private
merkushevio Apr 17, 2016
2aee760
edit MainPage
merkushevio Apr 18, 2016
ca304a3
edit WidgetTitle, DefaultSteps
merkushevio Apr 18, 2016
20ad2b1
create class with methods for tests
merkushevio Apr 19, 2016
f733c78
edit add widget test, work version
merkushevio Apr 20, 2016
dde504f
refactor tests
merkushevio Apr 20, 2016
629458c
add to tp
merkushevio Apr 20, 2016
acf585e
tp log errors
merkushevio Apr 20, 2016
48b4347
correct config test for test palm
merkushevio Apr 20, 2016
b2bdf20
refactor autocomplete
merkushevio Apr 20, 2016
627e54f
add test for view
merkushevio Apr 20, 2016
496265a
test cases and skipped test with bug
merkushevio Apr 21, 2016
2d6c887
refactor tests
merkushevio Apr 22, 2016
be84fdc
initial
merkushevio Apr 7, 2016
c40fb6a
initial
merkushevio Apr 7, 2016
cb6dc77
commit
merkushevio Apr 7, 2016
f25ef6f
commit
merkushevio Apr 7, 2016
1ba56d0
commit
merkushevio Apr 7, 2016
2e59ea8
First test complete
merkushevio Apr 7, 2016
08978d1
First test second version
merkushevio Apr 8, 2016
9a7e85b
First test second version
merkushevio Apr 8, 2016
a763192
Added commons-module and tests for user().goTo(place)
gladnik Apr 7, 2016
2182cfb
refactor tests, create new file WidgetSteps
merkushevio Apr 22, 2016
838ac46
pom files restore
merkushevio Apr 22, 2016
b6b2392
refactor test, add test view elements widget
merkushevio Apr 22, 2016
8d55c36
full test completed
merkushevio Apr 22, 2016
63c9944
refactor tests, add WidgetSteps, refactor MainPageMethods
merkushevio Apr 26, 2016
6eda7c3
enable Rule for TestPalm
merkushevio Apr 26, 2016
e0c49eb
init WebAPI test
merkushevio Apr 26, 2016
6963c7b
Merge remote-tracking branch 'origin/second_pratice' into second_pratice
merkushevio Apr 26, 2016
53b0385
refactor DefaultSteps, MainPageMethod, WeatherWebTest
merkushevio Apr 27, 2016
1366495
WebAPI tests first tests, disabled dependence to parent
merkushevio Apr 28, 2016
eecf948
db client module added
bluedogseyes Apr 28, 2016
a1fcb8a
System.getProperty for db properties
bluedogseyes Apr 28, 2016
7bfcff1
initial
merkushevio Apr 7, 2016
757c127
First test second version
merkushevio Apr 8, 2016
32d4f54
Added commons-module and tests for user().goTo(place)
gladnik Apr 7, 2016
1314b97
pom files restore
merkushevio Apr 22, 2016
bcb4f90
tp log errors
merkushevio Apr 20, 2016
1d904f1
add test for view
merkushevio Apr 20, 2016
5f26af0
refactor tests, add WidgetSteps, refactor MainPageMethods
merkushevio Apr 26, 2016
b4179ee
init WebAPI test
merkushevio Apr 26, 2016
a7ea8db
refactor WebDriver test, add db test, add webapi tests
merkushevio Apr 29, 2016
b31f89b
correct WebTest
merkushevio Apr 29, 2016
3b3aa04
init webapi tests, refactor webdriver tests, add db test
merkushevio Apr 30, 2016
24120e8
Update README.md
merkushevio May 3, 2016
3231a52
readme
merkushevio May 3, 2016
d077e0d
readme
merkushevio May 3, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Practice of automation school 2016
Repository с файлом для docker.
https://github.com/merkushevio/docker.git

See all info in repo [autoschool/autoschool.github.io](https://github.com/autoschool/autoschool.github.io)
58 changes: 58 additions & 0 deletions api-tests-module/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?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>
<packaging>jar</packaging>

<parent>
<artifactId>school-2016</artifactId>
<groupId>ru.qatools.school</groupId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>api-tests-module</artifactId>

<properties>
<compiler.version>1.8</compiler.version>

<dataprovider.version>1.10.4</dataprovider.version>
<retrofit.version>2.0.2</retrofit.version>
<lombok.version>1.16.6</lombok.version>
</properties>


<dependencies>
<dependency>
<groupId>ru.qatools.school</groupId>
<artifactId>steps-module</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ru.qatools.school</groupId>
<artifactId>dbclient-module</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.tngtech.java</groupId>
<artifactId>junit-dataprovider</artifactId>
<version>${dataprovider.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>retrofit</artifactId>
<version>${retrofit.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-gson</artifactId>
<version>${retrofit.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
</dependencies>
</project>
34 changes: 34 additions & 0 deletions api-tests-module/src/main/java/ru/qatools/school/ApiMatchers.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package ru.qatools.school;

import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeDiagnosingMatcher;
import ru.qatools.school.entity.City;

import java.util.List;

public class ApiMatchers {


public static Matcher<String> findInList(List<City> list) {
return new TypeSafeDiagnosingMatcher<String>() {
@Override
public void describeTo(Description description) {
description.appendText("expected inlist");
}

@Override
protected boolean matchesSafely(String word, Description mismatch) {
for (City city : list) {
if (city.getName().toLowerCase().contains(word.toLowerCase())) {
mismatch.appendText("return string was ")
.appendText(city.getName());
return true;
}
}

return false;
}
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package ru.qatools.school;

import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Query;
import ru.qatools.school.entity.City;
import ru.qatools.school.entity.Widget;

import java.util.List;


public interface WebApiInterface {

@GET("cities")
Call<List<City>> getCities();

@GET("init")
Call<List<City>> getInit();

@GET("cities")
Call<List<City>> getCitiesLimit(@Query("limit") String limit);

@GET("suggest")
Call<List<City>> getListSuggest(@Query("query") String query);

@GET("weather")
Call<Widget> getWeatherWidget(@Query("city") String city, @Query("region") String region);
}

24 changes: 24 additions & 0 deletions api-tests-module/src/main/java/ru/qatools/school/entity/City.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package ru.qatools.school.entity;


import lombok.Getter;

@Getter
public class City {

public City(int id, long uid, String name, String country) {
this.id = id;
this.uid = uid;
this.name = name;
this.country = country;
}

private int id;

private long uid;

private String name;

private String country;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package ru.qatools.school.entity;

public enum DAYPART {
DAY, NIGHT
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package ru.qatools.school.entity;


import lombok.Getter;

@Getter
public class Temperature {

public Temperature(String unit, double value) {
this.unit = unit;
this.value = value;
}

private String unit;

private double value;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package ru.qatools.school.entity;

import lombok.Getter;

import java.util.Date;
import java.util.List;


@Getter
public class Widget {


private String city;
private DAYPART daypart;
private int weathercode;
private Date sunset;
private Date sunrise;
private Date dt;
private int humidity;
private double wind;
private List<Temperature> temperatures;


public Widget(String city, DAYPART daypart,
int weathercode, Date sunset, Date sunrise, Date dt, int humidity,
double wind, List<Temperature> temperatures) {
this.city = city;
this.daypart = daypart;
this.weathercode = weathercode;
this.sunset = sunset;
this.sunrise = sunrise;
this.dt = dt;
this.humidity = humidity;
this.wind = wind;
this.temperatures = temperatures;
}
}
54 changes: 54 additions & 0 deletions api-tests-module/src/test/java/ru/qatools/school/WeatherDB.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package ru.qatools.school;

import com.google.gson.Gson;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import retrofit2.Call;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.*;
import ru.qatools.school.entity.City;
import java.io.IOException;
import java.util.List;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;

public class WeatherDB {

private static DbClient dbClient;
private static final String MAIN_PAGE = "http://weather.lanwen.ru/api/";
private static WebApiInterface webApiInterface;
private static final String city = "Moscow";


@BeforeClass
public static void getDbClient() {
dbClient = new DbClient();
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(MAIN_PAGE)
.addConverterFactory(GsonConverterFactory.create(new Gson()))
.build();
webApiInterface = retrofit.create(WebApiInterface.class);
}


@Test
public void shouldSeeResultFromAPIEqualResultFromDB() throws IOException {
String cityDb = dbClient.getCityById(3);
Call<List<City>> callSuggest = webApiInterface.getListSuggest(city);
Response<List<City>> response = callSuggest.execute();
assertThat("Вывод от метода suggest по запросу " + city + " не совпадает с выводом из базы данных", cityDb,
equalTo(response.body().get(0).getName()));
}




@AfterClass
public static void closeDbClient() {
dbClient.close();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package ru.qatools.school.restassured;

import org.apache.http.HttpStatus;
import org.junit.Test;
import static com.jayway.restassured.RestAssured.given;
import static org.hamcrest.Matchers.*;


public class WeatherWebApiRest {

private static final String MAIN_PAGE = "http://weather.lanwen.ru";
private static final String BASE_PATH = "api";
private static final String WEATHER = "weather";
private static final String CITIES = "cities";
private static final String INIT = "init";
private static final String CITY = "Moscow";
private static final int ZERO = 0;
private static final int ONE = 1;


@Test
public void shouldSeeCitiesCityRecord() {
given().baseUri(MAIN_PAGE).basePath(BASE_PATH).param("city", "Moscow")
.get(WEATHER)
.then().assertThat().statusCode(HttpStatus.SC_OK)
.and().body("city", equalTo("Moscow"))
.and().body("temperatures", hasSize(4));

}

@Test
public void shouldSeeInitCitiesRecords() {
given().baseUri(MAIN_PAGE).basePath(BASE_PATH)
.get(CITIES)
.then().assertThat().statusCode(HttpStatus.SC_OK)
.and().body("size()", greaterThan(ZERO));
}

@Test
public void shouldSeeCitiesListCities() {
given().baseUri(MAIN_PAGE).basePath(BASE_PATH)
.get(CITIES)
.then().assertThat().statusCode(HttpStatus.SC_OK)
.and().body("size()", greaterThan(ZERO));
}

@Test
public void shouldSeeCitiesLimitOneCity() {
given().baseUri(MAIN_PAGE).basePath(BASE_PATH).param("limit", ONE)
.get(CITIES)
.then().assertThat().statusCode(HttpStatus.SC_OK)
.and().body("size()", is(ONE));
}



}


Loading