-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from allure-framework/feature/allure-android-s…
…ample Allure Android Sample
- Loading branch information
Showing
39 changed files
with
841 additions
and
13 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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 @@ | ||
* @kamildziadek @viclovsky |
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,13 @@ | ||
name: "Verify type labels" | ||
|
||
on: | ||
pull_request: | ||
types: [opened, labeled, unlabeled, synchronize] | ||
|
||
jobs: | ||
triage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: zwaldowski/match-label-action@v2 | ||
with: | ||
allowed: 'type:new feature, type:improvement, type:bug' |
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
11 changes: 11 additions & 0 deletions
11
...id/src/main/java/io/qameta/allure/android/listeners/ExternalStoragePermissionsListener.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,11 @@ | ||
package io.qameta.allure.android.listeners | ||
|
||
import io.qameta.allure.android.internal.requestExternalStoragePermissions | ||
import org.junit.runner.* | ||
import org.junit.runner.notification.* | ||
|
||
class ExternalStoragePermissionsListener : RunListener() { | ||
override fun testRunStarted(description: Description?) { | ||
requestExternalStoragePermissions() | ||
} | ||
} |
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,54 @@ | ||
plugins { | ||
id("com.android.application") | ||
id("kotlin-android") | ||
} | ||
|
||
android { | ||
compileSdkVersion(Versions.Android.compileSdk) | ||
defaultConfig { | ||
applicationId = "io.qameta.allure.sample.junit4.android" | ||
minSdkVersion(Versions.Android.minSdk) | ||
targetSdkVersion(Versions.Android.targetSdk) | ||
versionCode = 1 | ||
versionName = version as String | ||
|
||
testInstrumentationRunner = "io.qameta.allure.android.runners.AllureAndroidJUnitRunner" | ||
testInstrumentationRunnerArguments(mapOf("clearPackageData" to "true")) | ||
} | ||
|
||
buildTypes { | ||
getByName("release") { | ||
isMinifyEnabled = false | ||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") | ||
} | ||
} | ||
|
||
sourceSets { | ||
val sharedTestDir = "src/sharedTest/java" | ||
getByName("test").java.srcDir(sharedTestDir) | ||
getByName("androidTest").java.srcDir(sharedTestDir) | ||
} | ||
|
||
testOptions.unitTests.isIncludeAndroidResources = true | ||
} | ||
|
||
dependencies { | ||
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) | ||
implementation(kotlin("stdlib-jdk7", Versions.kotlin)) | ||
|
||
implementation("androidx.appcompat:appcompat:${Versions.Android.androidX}") | ||
implementation("androidx.core:core-ktx:${Versions.Android.androidX}") | ||
|
||
listOf( | ||
project(":allure-kotlin-android"), | ||
"androidx.test.ext:junit:${Versions.Android.Test.junit}", | ||
"androidx.test:runner:${Versions.Android.Test.runner}", | ||
"junit:junit:${Versions.junit4}", | ||
"androidx.test.espresso:espresso-core:${Versions.Android.Test.espresso}" | ||
).forEach { | ||
testImplementation(it) | ||
androidTestImplementation(it) | ||
} | ||
|
||
testImplementation("org.robolectric:robolectric:${Versions.Android.Test.robolectric}") | ||
} |
Empty file.
1 change: 1 addition & 0 deletions
1
...t/resources/META-INF/services/io.qameta.allure.kotlin.listener.ContainerLifecycleListener
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 @@ | ||
io.qameta.allure.android.listeners.LogcatContainerListener |
1 change: 1 addition & 0 deletions
1
...idTest/resources/META-INF/services/io.qameta.allure.kotlin.listener.StepLifecycleListener
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 @@ | ||
io.qameta.allure.android.listeners.LogcatStepLifecycleListener |
1 change: 1 addition & 0 deletions
1
...idTest/resources/META-INF/services/io.qameta.allure.kotlin.listener.TestLifecycleListener
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 @@ | ||
io.qameta.allure.android.listeners.LogcatTestLifecycleListener |
2 changes: 2 additions & 0 deletions
2
samples/junit4-android/src/androidTest/resources/allure.properties
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,2 @@ | ||
allure.results.directory=allure-results | ||
allure.link.issue.pattern=https://jira.domain-name.com/browse/{} |
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,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="io.qameta.allure.sample.junit4.android"> | ||
|
||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | ||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
</manifest> |
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,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="io.qameta.allure.sample.junit4.android"> | ||
|
||
<application | ||
android:allowBackup="false" | ||
android:icon="@mipmap/ic_launcher" | ||
tools:ignore="GoogleAppIndexingWarning"> | ||
<activity | ||
android:name=".SampleActivity" | ||
android:theme="@style/AppTheme.NoActionBar"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name=".CrashActivity" | ||
android:theme="@style/AppTheme.NoActionBar" /> | ||
</application> | ||
</manifest> |
36 changes: 36 additions & 0 deletions
36
samples/junit4-android/src/main/java/io/qameta/allure/sample/junit4/android/CrashActivity.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,36 @@ | ||
package io.qameta.allure.sample.junit4.android | ||
|
||
import android.os.Bundle | ||
import android.widget.Button | ||
import androidx.annotation.VisibleForTesting | ||
import androidx.appcompat.app.AppCompatActivity | ||
import java.util.concurrent.Executors | ||
import java.util.concurrent.TimeUnit | ||
|
||
class CrashActivity : AppCompatActivity() { | ||
|
||
private val crashImmediate: Button | ||
get() = findViewById(R.id.button_crash_immediate) | ||
private val crashAsync: Button | ||
get() = findViewById(R.id.button_crash_async) | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_crash) | ||
|
||
crashImmediate.setOnClickListener { | ||
throw IllegalStateException("Crashing on purpose!") | ||
} | ||
crashAsync.setOnClickListener { | ||
Executors.newSingleThreadExecutor().execute { | ||
Thread.sleep(ASYNC_CRASH_TIME_MS) | ||
throw IllegalStateException("Crashing async on purpose!") | ||
} | ||
} | ||
} | ||
|
||
companion object { | ||
@VisibleForTesting | ||
val ASYNC_CRASH_TIME_MS: Long = TimeUnit.SECONDS.toMillis(1) | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...les/junit4-android/src/main/java/io/qameta/allure/sample/junit4/android/SampleActivity.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 @@ | ||
package io.qameta.allure.sample.junit4.android | ||
|
||
import android.os.Bundle | ||
import android.widget.Button | ||
import android.widget.TextView | ||
import androidx.appcompat.app.AppCompatActivity | ||
|
||
class SampleActivity : AppCompatActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_sample) | ||
|
||
findViewById<Button>(R.id.button_some).setOnClickListener { | ||
findViewById<TextView>(R.id.label_some).text = getString(R.string.after_click) | ||
} | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
...s/junit4-android/src/main/java/io/qameta/allure/sample/junit4/android/SampleCalculator.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,6 @@ | ||
package io.qameta.allure.sample.junit4.android | ||
|
||
class SampleCalculator { | ||
fun add(x: Int, y: Int): Int = x + y | ||
fun subtract(x: Int, y: Int): Int = x - y | ||
} |
34 changes: 34 additions & 0 deletions
34
samples/junit4-android/src/main/res/drawable-v24/ic_launcher_foreground.xml
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,34 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:aapt="http://schemas.android.com/aapt" | ||
android:width="108dp" | ||
android:height="108dp" | ||
android:viewportWidth="108" | ||
android:viewportHeight="108"> | ||
<path | ||
android:fillType="evenOdd" | ||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z" | ||
android:strokeWidth="1" | ||
android:strokeColor="#00000000"> | ||
<aapt:attr name="android:fillColor"> | ||
<gradient | ||
android:endX="78.5885" | ||
android:endY="90.9159" | ||
android:startX="48.7653" | ||
android:startY="61.0927" | ||
android:type="linear"> | ||
<item | ||
android:color="#44000000" | ||
android:offset="0.0" /> | ||
<item | ||
android:color="#00000000" | ||
android:offset="1.0" /> | ||
</gradient> | ||
</aapt:attr> | ||
</path> | ||
<path | ||
android:fillColor="#FFFFFF" | ||
android:fillType="nonZero" | ||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z" | ||
android:strokeWidth="1" | ||
android:strokeColor="#00000000" /> | ||
</vector> |
Oops, something went wrong.