Skip to content

Commit

Permalink
test: Add "test" Module
Browse files Browse the repository at this point in the history
  • Loading branch information
wba2hi committed Oct 13, 2023
1 parent 6c0f5c9 commit e9a31ce
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 13 deletions.
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ plugins {

dependencies {
implementation(project(":kuksa-sdk"))
testImplementation(project(":test"))

implementation(libs.androidx.appcompat)
implementation(libs.androidx.lifecycle.runtime.ktx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
package org.eclipse.kuksa.testapp.extension

import io.kotest.core.spec.style.BehaviorSpec
import org.eclipse.kuksa.test.kotest.Unit
import org.junit.jupiter.api.Assertions

class LogExtensionTest : BehaviorSpec({
tags(Unit)

val expectedLogTag = AnyClass::class.simpleName

given("Any class") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ import io.kotest.core.spec.style.BehaviorSpec
import io.kotest.matchers.shouldBe
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.eclipse.kuksa.test.kotest.Unit
import java.io.File
import java.io.FileWriter

class ConnectionInfoTest : BehaviorSpec({
tags(Unit)

given("A custom ConnectionInfo with a custom Certificate") {
// Uri is an android specific class, which does not exist in plain JUnit. Methods like Uri.parse will simply
// return null due to the addition of testOptions.unitTests.isReturnDefaultValues true
Expand Down
2 changes: 2 additions & 0 deletions kuksa-sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ android {
}

dependencies {
testImplementation(project(":test"))

// needs to be api as long as we expose ProtoBuf specific objects
api(libs.grpc.protobuf)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ import kotlinx.coroutines.runBlocking
import org.eclipse.kuksa.model.Property
import org.eclipse.kuksa.proto.v1.Types
import org.eclipse.kuksa.proto.v1.Types.Datapoint
import org.eclipse.kuksa.test.databroker.DataBrokerConnectorProvider
import org.eclipse.kuksa.test.kotest.Integration
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertFalse
import org.junit.jupiter.api.Assertions.assertTrue
import test.databroker.DataBrokerConnectorProvider
import test.kotest.Integration
import kotlin.random.Random

class DataBrokerConnectionTest : BehaviorSpec({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
package org.eclipse.kuksa

import io.kotest.core.spec.style.BehaviorSpec
import org.eclipse.kuksa.test.databroker.DataBrokerConnectorProvider
import org.eclipse.kuksa.test.kotest.Integration
import org.eclipse.kuksa.test.kotest.Secure
import org.junit.jupiter.api.Assertions
import test.databroker.DataBrokerConnectorProvider
import test.kotest.Integration
import test.kotest.Secure

class DataBrokerConnectorSecureTest : BehaviorSpec({
tags(Integration, Secure)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
package org.eclipse.kuksa

import io.kotest.core.spec.style.BehaviorSpec
import org.eclipse.kuksa.test.databroker.DataBrokerConnectorProvider
import org.eclipse.kuksa.test.kotest.Insecure
import org.eclipse.kuksa.test.kotest.Integration
import org.junit.jupiter.api.Assertions
import test.databroker.DataBrokerConnectorProvider
import test.kotest.Insecure
import test.kotest.Integration

class DataBrokerConnectorTest : BehaviorSpec({
tags(Integration, Insecure)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package org.eclipse.kuksa.pattern.listener

import io.kotest.core.spec.style.BehaviorSpec
import io.kotest.matchers.shouldBe
import test.kotest.Unit
import org.eclipse.kuksa.test.kotest.Unit

class MultiListenerTest : BehaviorSpec({
tags(Unit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
*/

package test.databroker
package org.eclipse.kuksa.test.databroker

import java.util.concurrent.TimeUnit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
*/

package test.databroker
package org.eclipse.kuksa.test.databroker

import io.grpc.ChannelCredentials
import io.grpc.Grpc
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ dependencyResolutionManagement {
include(":app")
include(":kuksa-sdk")
include(":samples")
include(":test")
1 change: 1 addition & 0 deletions test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
46 changes: 46 additions & 0 deletions test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*
*/

@Suppress("DSL_SCOPE_VIOLATION") // Remove once KTIJ-19369 is fixed
plugins {
id("com.android.library")
kotlin("android")
}

android {
namespace = "org.eclipse.kuksa.test"
compileSdk = 33

defaultConfig {
minSdk = 24
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {
implementation(libs.kotest)
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
*/

package test.kotest
package org.eclipse.kuksa.test.kotest

import io.kotest.core.config.AbstractProjectConfig

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
*/

package test.kotest
package org.eclipse.kuksa.test.kotest

import io.kotest.core.NamedTag

Expand Down

0 comments on commit e9a31ce

Please sign in to comment.