-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* M4l4 testing
- Loading branch information
Showing
93 changed files
with
2,819 additions
and
172 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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,28 @@ | ||
### Карточка тестового случая | ||
|
||
**Название:** Проверка корректного отображения формы регистрации | ||
|
||
**Описание:** | ||
Этот тестовый случай проверяет, что форма регистрации отображается на платформе корректно и все ее элементы доступны для | ||
ввода данных. | ||
|
||
**Предусловия:** | ||
|
||
1. Доступ к интернету. | ||
2. Пользователь находится на странице регистрации платформы. | ||
|
||
**Шаги:** | ||
|
||
1. Открыть веб-браузер и перейти на страницу регистрации платформы. | ||
2. Проверить, что форма регистрации отображается на экране. | ||
3. Убедиться, что все необходимые поля для ввода данных присутствуют на форме (например, поле для ввода электронной | ||
почты, пароля, имени и т. д.). | ||
4. Проверить, что форма содержит кнопку "Зарегистрироваться" или аналогичную, предназначенную для отправки данных. | ||
5. Проверить визуальное оформление формы: соответствие цветовой схеме платформы, четкость текста, отступы и т. д. | ||
6. Попробовать ввести тестовые данные в поля формы и убедиться, что они корректно отображаются. | ||
|
||
**Ожидаемый результат:** | ||
Форма регистрации отображается корректно, все необходимые поля присутствуют и доступны для ввода данных, визуальное | ||
оформление соответствует стандартам дизайна платформы. | ||
|
||
**Тип теста:** Функциональный тест, UI/UX тест |
This file contains 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,25 @@ | ||
### Карточка тестового случая | ||
|
||
**Название:** Ввод корректных данных и нажатие кнопки "Зарегистрироваться" | ||
|
||
**Описание:** | ||
Этот тестовый случай проверяет корректность процесса регистрации на платформе после ввода корректных данных в форму | ||
регистрации. | ||
|
||
**Предусловия:** | ||
|
||
1. Доступ к интернету. | ||
2. Пользователь находится на странице регистрации платформы. | ||
|
||
**Шаги:** | ||
|
||
1. Открыть веб-браузер и перейти на страницу регистрации платформы. | ||
2. Убедиться, что форма регистрации отображается на экране. | ||
3. Ввести корректные данные в поля формы (например, действительный адрес электронной почты, пароль, имя и т. д.). | ||
4. Нажать кнопку "Зарегистрироваться" или аналогичную, предназначенную для отправки данных. | ||
5. Дождаться ответа от сервера. | ||
|
||
**Ожидаемый результат:** | ||
Пользователь успешно зарегистрирован на платформе после ввода корректных данных и нажатия кнопки "Зарегистрироваться". | ||
|
||
**Тип теста:** Функциональный тест |
This file contains 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,24 @@ | ||
### Карточка тестового случая | ||
|
||
**Название:** Проверка возможности создания нового объявления о компоненте | ||
|
||
**Описание:** | ||
Этот тестовый случай проверяет функциональность создания нового объявления о компоненте на платформе. | ||
|
||
**Предусловия:** | ||
|
||
1. Доступ к интернету. | ||
2. Пользователь авторизован на платформе и находится на странице управления объявлениями. | ||
|
||
**Шаги:** | ||
|
||
1. Открыть веб-браузер и перейти на страницу управления объявлениями на платформе. | ||
2. Нажать кнопку "Создать новое объявление" или аналогичную. | ||
3. Заполнить все обязательные поля для нового объявления (например, заголовок, описание, цена, изображения и т. д.). | ||
4. Нажать кнопку "Сохранить" или аналогичную для создания объявления. | ||
5. Проверить, что объявление успешно создано и отображается на платформе. | ||
|
||
**Ожидаемый результат:** | ||
Новое объявление о компоненте успешно создано и отображается на платформе, все введенные данные корректно отображаются. | ||
|
||
**Тип теста:** Функциональный тест |
This file contains 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
This file contains 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
This file contains 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,84 @@ | ||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat | ||
import org.gradle.api.tasks.testing.logging.TestLogEvent | ||
|
||
plugins { | ||
kotlin("multiplatform") | ||
id("io.kotest.multiplatform") | ||
} | ||
|
||
kotlin { | ||
jvm {} | ||
js { | ||
browser { | ||
// testTask { | ||
// useMocha() | ||
// } | ||
} | ||
binaries.executable() | ||
} | ||
|
||
val kotestVersion: String by project | ||
val coroutinesVersion: String by project | ||
val jUnitJupiterVersion: String by project | ||
|
||
sourceSets { | ||
val commonMain by getting { | ||
dependencies { | ||
implementation(kotlin("stdlib-common")) | ||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion") | ||
} | ||
} | ||
val commonTest by getting { | ||
dependencies { | ||
implementation(kotlin("test-common")) | ||
implementation(kotlin("test-annotations-common")) | ||
|
||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion") | ||
|
||
implementation("io.kotest:kotest-framework-engine:$kotestVersion") | ||
implementation("io.kotest:kotest-framework-datatest:$kotestVersion") | ||
implementation("io.kotest:kotest-assertions-core:$kotestVersion") | ||
implementation("io.kotest:kotest-property:$kotestVersion") | ||
} | ||
} | ||
// val jsMain by getting { | ||
// dependencies { | ||
// implementation(kotlin("stdlib-js")) | ||
// } | ||
// } | ||
val jsTest by getting { | ||
dependencies { | ||
implementation(kotlin("test-js")) | ||
} | ||
} | ||
val jvmMain by getting { | ||
dependencies { | ||
implementation(kotlin("stdlib")) | ||
} | ||
} | ||
val jvmTest by getting { | ||
dependencies { | ||
implementation(kotlin("test-junit5")) | ||
implementation("io.kotest:kotest-runner-junit5-jvm:$kotestVersion") | ||
implementation("org.junit.jupiter:junit-jupiter-params:$jUnitJupiterVersion") | ||
} | ||
} | ||
} | ||
} | ||
|
||
tasks { | ||
withType<Test>().configureEach { | ||
useJUnitPlatform { | ||
// includeTags.add("sampling") | ||
} | ||
filter { | ||
isFailOnNoMatchingTests = false | ||
} | ||
testLogging { | ||
showExceptions = true | ||
showStandardStreams = true | ||
events = setOf(TestLogEvent.FAILED, TestLogEvent.PASSED) | ||
exceptionFormat = TestExceptionFormat.FULL | ||
} | ||
} | ||
} |
This file contains 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,6 @@ | ||
data class DateString( | ||
val iso: String | ||
) | ||
|
||
//for ex 2022-04-16T07:50:06.696578 | ||
expect fun currentDate(): DateString |
30 changes: 30 additions & 0 deletions
30
lessons/m4l4-testing/src/commonTest/kotlin/CommonTestCase.kt
This file contains 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,30 @@ | ||
import io.kotest.core.spec.style.FunSpec | ||
import io.kotest.matchers.shouldBe | ||
import io.kotest.matchers.string.shouldContain | ||
import io.kotest.matchers.string.shouldContainOnlyDigits | ||
|
||
class UUIDTestCommon : FunSpec() { | ||
init { | ||
test("date should starts with year") { | ||
println(currentDate().iso) | ||
currentDate().iso | ||
.take(4) | ||
.shouldContainOnlyDigits() | ||
} | ||
|
||
test("date should contains separator") { | ||
currentDate().iso shouldContain "T" | ||
} | ||
|
||
test("date should contains date and time") { | ||
val data = currentDate().iso | ||
.split("T") | ||
|
||
//simple checs | ||
data.size shouldBe 2 | ||
|
||
data.first().filter { it == '-' }.length shouldBe 2 | ||
data.last().filter { it == ':' } shouldBe "::" | ||
} | ||
} | ||
} |
This file contains 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,25 @@ | ||
import kotlin.test.* | ||
|
||
class KTestTest { | ||
|
||
@Test | ||
fun kTest() { | ||
assertEquals(4, 2 * 2) | ||
} | ||
|
||
@Ignore | ||
@Test | ||
fun ignoredTest() { | ||
println("I will never be invoked") | ||
} | ||
|
||
@BeforeTest | ||
fun beforeTest() { | ||
println("Before Test") | ||
} | ||
|
||
@AfterTest | ||
fun afterTest() { | ||
println("After Test") | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
lessons/m4l4-testing/src/commonTest/kotlin/KotestWithBDD.kt
This file contains 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,19 @@ | ||
import io.kotest.core.spec.style.BehaviorSpec | ||
|
||
class KotestWithBDD() : BehaviorSpec({ | ||
Given("State A") { | ||
println("state A ") | ||
When("Action A") { | ||
println("in action A") | ||
Then("State => A1") { | ||
println("becomes A1") | ||
} | ||
} | ||
When("Action B") { | ||
println("in action B") | ||
Then("State => B1") { | ||
println("becomes B1") | ||
} | ||
} | ||
} | ||
}) |
47 changes: 47 additions & 0 deletions
47
lessons/m4l4-testing/src/commonTest/kotlin/KotestWithParams.kt
This file contains 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,47 @@ | ||
import io.kotest.assertions.assertSoftly | ||
import io.kotest.common.ExperimentalKotest | ||
import io.kotest.common.Platform | ||
import io.kotest.common.platform | ||
import io.kotest.core.spec.style.DescribeSpec | ||
import io.kotest.core.spec.style.ShouldSpec | ||
import io.kotest.core.spec.style.describeSpec | ||
import io.kotest.data.forAll | ||
import io.kotest.data.row | ||
import io.kotest.datatest.withData | ||
import io.kotest.matchers.shouldBe | ||
import io.kotest.matchers.string.shouldMatch | ||
|
||
class KotestWithParams : ShouldSpec({ | ||
withData( | ||
mapOf( | ||
"10x2" to Triple(10, 2, 20), | ||
"20x2" to Triple(20, 2, 40), | ||
"30x2" to Triple(30, 2, 60), | ||
) | ||
) { (a, b, c) -> | ||
a * b shouldBe c | ||
} | ||
}) | ||
|
||
@OptIn(ExperimentalKotest::class) | ||
class EmailTest : DescribeSpec({ | ||
include(emailValidation) | ||
}) | ||
|
||
@ExperimentalKotest | ||
val emailValidation = describeSpec { | ||
|
||
// describe("Registration").config(enabled = platform != Platform.JS) { | ||
describe("Registration").config(enabled = platform != Platform.JS) { | ||
context("Checking user's mail") { | ||
forAll( | ||
row("[email protected]"), | ||
row("[email protected]"), | ||
) { | ||
assertSoftly { | ||
it shouldMatch "^(.+)@(.+)\$" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains 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,5 @@ | ||
import kotlin.js.Date | ||
|
||
actual fun currentDate(): DateString { | ||
return DateString(Date().toISOString()) | ||
} |
This file contains 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,28 @@ | ||
import io.kotest.core.spec.style.StringSpec | ||
import io.kotest.matchers.shouldBe | ||
import io.kotest.matchers.string.shouldContain | ||
import io.kotest.matchers.string.shouldContainOnlyDigits | ||
|
||
class UUIDTestJS : StringSpec({ | ||
"date should starts with year" { | ||
println(currentDate().iso) // sample for sout in js | ||
currentDate().iso | ||
.take(4) | ||
.shouldContainOnlyDigits() | ||
} | ||
|
||
"date should contains separator" { | ||
currentDate().iso shouldContain "T" | ||
} | ||
|
||
"date should contains date and time" { | ||
val data = currentDate().iso | ||
.split("T") | ||
|
||
//simple checks | ||
data.size shouldBe 2 | ||
|
||
data.first().filter { it == '-' }.length shouldBe 2 | ||
data.last().filter { it == ':' } shouldBe "::" | ||
} | ||
}) |
Oops, something went wrong.