From d1c10441b16656487c0e72f770bf048a73d868ef Mon Sep 17 00:00:00 2001 From: "a.y.ivanov2" Date: Wed, 28 Feb 2018 11:46:27 +0300 Subject: [PATCH 1/3] github version 2.5.1 --- .gitignore | 6 +- allure-android/allure-android-lint.xml | 5 +- allure-android/build.gradle | 77 +++++++++++---- allure-android/proguard-rules.pro | 16 +-- .../src/androidTest/AndroidManifest.xml | 7 ++ .../ru/tinkoff/allure/android/CrashTest.kt | 32 ++++++ .../src/espresso/AndroidManifest.xml | 9 ++ .../ru/tinkoff/allure/CrashTestActivity.kt | 36 +++++++ .../src/espresso/res/layout/activity_test.xml | 37 +++++++ .../src/espresso/res/values/strings.xml | 4 + .../allure/android/AllureAndroidListener.kt | 65 ++++++++++--- .../ru/tinkoff/allure/android/AllureRunner.kt | 21 ++++ .../ru/tinkoff/allure/android/FailshotRule.kt | 21 ++-- .../ru/tinkoff/allure/android/Screenshot.kt | 5 +- .../tinkoff/allure/listener/LogCatListener.kt | 42 ++++---- allure-common/.gitignore | 2 + allure-common/build.gradle | 32 ++++-- .../ru/tinkoff/allure/AllureLifecycle.kt | 39 +++----- .../ru/tinkoff/allure/AllureRunListener.kt | 31 +++--- .../kotlin/ru/tinkoff/allure/AllureStorage.kt | 24 ++--- .../kotlin/ru/tinkoff/allure/SoftAssert.kt | 36 +++---- .../src/main/kotlin/ru/tinkoff/allure/Step.kt | 6 +- .../tinkoff/allure/io/AllureFileConstants.kt | 92 +++++++----------- .../tinkoff/allure/io/AllureResultsReader.kt | 1 + .../allure/io/FileSystemResultsReader.kt | 38 ++++++++ ...esultsRW.kt => FileSystemResultsWriter.kt} | 21 ++-- .../allure/utils/ResultsUtilsCommon.kt | 44 ++++----- .../ru/tinkoff/allure/AllureLifecycleTest.kt | 39 ++++---- .../ru/tinkoff/allure/AllureStorageTest.kt | 26 +++++ .../ru/tinkoff/allure/SoftAssertTest.kt | 51 +++++----- .../test/kotlin/ru/tinkoff/allure/StepTest.kt | 9 +- .../gson/GsonSerializationProcessorTest.kt | 12 +-- allure-model/build.gradle | 24 ++++- .../ru/tinkoff/allure/model/ExecutableItem.kt | 24 +++-- .../ru/tinkoff/allure/model/Parameter.kt | 3 - .../kotlin/ru/tinkoff/allure/model/Status.kt | 4 +- .../allure/model/ExecutableItemTest.kt | 60 ++++++++++-- build.gradle | 31 ++---- gradle.properties | 2 +- gradle/plugin/maven.gradle | 78 +++++++++++++++ gradle/versions.gradle | 32 +++--- gradle/wrapper/gradle-wrapper.jar | Bin 54706 -> 54708 bytes gradle/wrapper/gradle-wrapper.properties | 3 +- settings.gradle | 8 +- 44 files changed, 773 insertions(+), 382 deletions(-) create mode 100644 allure-android/src/androidTest/AndroidManifest.xml create mode 100644 allure-android/src/androidTest/kotlin/ru/tinkoff/allure/android/CrashTest.kt create mode 100644 allure-android/src/espresso/AndroidManifest.xml create mode 100644 allure-android/src/espresso/kotlin/ru/tinkoff/allure/CrashTestActivity.kt create mode 100644 allure-android/src/espresso/res/layout/activity_test.xml create mode 100644 allure-android/src/espresso/res/values/strings.xml create mode 100644 allure-android/src/main/kotlin/ru/tinkoff/allure/android/AllureRunner.kt create mode 100644 allure-common/.gitignore create mode 100644 allure-common/src/main/kotlin/ru/tinkoff/allure/io/FileSystemResultsReader.kt rename allure-common/src/main/kotlin/ru/tinkoff/allure/io/{FileSystemResultsRW.kt => FileSystemResultsWriter.kt} (71%) create mode 100644 allure-common/src/test/kotlin/ru/tinkoff/allure/AllureStorageTest.kt create mode 100644 gradle/plugin/maven.gradle diff --git a/.gitignore b/.gitignore index 9c3c249..78830f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # IDEA -.idea +.idea/* +!.idea/runConfigurations/ *.iml # Gradle @@ -8,4 +9,5 @@ build /local.properties # Other -.DS_Store \ No newline at end of file +.DS_Store + diff --git a/allure-android/allure-android-lint.xml b/allure-android/allure-android-lint.xml index 9e9012f..f58e781 100644 --- a/allure-android/allure-android-lint.xml +++ b/allure-android/allure-android-lint.xml @@ -1,6 +1,7 @@ - - + + + \ No newline at end of file diff --git a/allure-android/build.gradle b/allure-android/build.gradle index 7c7df70..ef6c35d 100644 --- a/allure-android/build.gradle +++ b/allure-android/build.gradle @@ -1,17 +1,21 @@ -apply plugin: "com.android.library" -apply plugin: "kotlin-android" +apply from: "${rootDir}/gradle/plugin/maven.gradle" -dependencies { - compile project(":allure-model") - compile project(":allure-common") - compile "org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}" - compile "com.android.support:support-annotations:${supportVersion}" - compile "com.android.support.test:runner:${supportTestVersion}" - compile "com.android.support:multidex:${multidexVersion}" - compile "com.android.support.test.uiautomator:uiautomator-v18:${uiAutomatorVersion}" - compile "junit:junit:${jUnitVersion}" +buildscript { + apply from: '../gradle/versions.gradle' + apply from: '../gradle/common.gradle' + repositories { + google() + jcenter() + } + dependencies { + classpath "com.android.tools.build:gradle:${androidPlugin}" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}" + } } +apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' + android { compileSdkVersion rootProject.compileSdkVersion buildToolsVersion rootProject.buildToolsVersion @@ -19,26 +23,59 @@ android { defaultConfig { targetSdkVersion rootProject.compileSdkVersion minSdkVersion rootProject.minSdkVersion - versionName rootProject.version + versionName rootProject.projectVersion testInstrumentationRunner "ru.tinkoff.allure.android.AllureAndroidRunner" } lintOptions { - htmlReport true - abortOnError true - warningsAsErrors true + htmlReport false + abortOnError false + warningsAsErrors false lintConfig file("${project.name}-lint.xml") } packagingOptions { - exclude "LICENSE.txt" - exclude "META-INF/LICENSE.txt" - exclude "META-INF/NOTICE.txt" + exclude 'LICENSE.txt' + exclude 'META-INF/LICENSE.txt' + exclude 'META-INF/NOTICE.txt' } sourceSets { - main.java.srcDirs += "src/main/kotlin" - androidTest.java.srcDirs += "src/androidTest/kotlin" + main.java.srcDirs += 'src/main/kotlin' + espresso.java.srcDirs += 'src/espresso/kotlin' + androidTest.java.srcDirs += 'src/androidTest/kotlin' } + + testBuildType 'espresso' + buildTypes { + espresso { + initWith debug + } + } +} + +dependencies { + implementation project(':allure-model') + implementation project(':allure-common') + implementation "org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}" + implementation "com.android.support:support-annotations:${supportVersion}" + implementation "com.android.support.test:runner:${supportTestVersion}" + implementation "com.android.support.test:rules:${supportTestVersion}" + implementation "com.android.support:multidex:${multidexVersion}" + implementation "com.android.support.test.uiautomator:uiautomator-v18:${uiAutomatorVersion}" + implementation "junit:junit:${jUnitVersion}" + + androidTestImplementation "org.jetbrains.kotlin:kotlin-test-junit:${kotlinVersion}" + androidTestImplementation "com.android.support.test.espresso:espresso-core:${espressoVersion}" + + espressoImplementation "com.android.support:appcompat-v7:${supportVersion}" + espressoImplementation "com.android.support.constraint:constraint-layout:1.0.2" + espressoImplementation "io.reactivex:rxjava:1.3.4" +} + +task copyLibs(type: Copy) { + from configurations.compile + from configurations.testCompile + into 'libs' } \ No newline at end of file diff --git a/allure-android/proguard-rules.pro b/allure-android/proguard-rules.pro index 5fa9b74..8031a3f 100644 --- a/allure-android/proguard-rules.pro +++ b/allure-android/proguard-rules.pro @@ -32,11 +32,11 @@ ajc* ; } --keepnames class ru.tinkoff.mobileutils.** { *; } --keepnames class ru.tinkoff.mobileutils.allure.** { *; } --keepnames class ru.tinkoff.mobileutils.utils.** { *; } --keepnames interface ru.tinkoff.mobileutils.** { *; } --keep class ru.tinkoff.mobileutils.** { *; } --keep class ru.tinkoff.mobileutils.allure.** { *; } --keep class ru.tinkoff.mobileutils.utils.** { *; } --keep interface ru.tinkoff.mobileutils.** { *; } \ No newline at end of file +-keepnames class ru.tinkoff.** { *; } +-keepnames class ru.tinkoff.allure.** { *; } +-keepnames class ru.tinkoff.utils.** { *; } +-keepnames interface ru.tinkoff.** { *; } +-keep class ru.tinkoff.** { *; } +-keep class ru.tinkoff.allure.** { *; } +-keep class ru.tinkoff.utils.** { *; } +-keep interface ru.tinkoff.** { *; } \ No newline at end of file diff --git a/allure-android/src/androidTest/AndroidManifest.xml b/allure-android/src/androidTest/AndroidManifest.xml new file mode 100644 index 0000000..5e37692 --- /dev/null +++ b/allure-android/src/androidTest/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/allure-android/src/androidTest/kotlin/ru/tinkoff/allure/android/CrashTest.kt b/allure-android/src/androidTest/kotlin/ru/tinkoff/allure/android/CrashTest.kt new file mode 100644 index 0000000..6d838d7 --- /dev/null +++ b/allure-android/src/androidTest/kotlin/ru/tinkoff/allure/android/CrashTest.kt @@ -0,0 +1,32 @@ +package ru.tinkoff.allure + +import android.content.Intent +import android.support.test.InstrumentationRegistry +import android.support.test.espresso.Espresso.onView +import android.support.test.espresso.action.ViewActions.click +import android.support.test.espresso.matcher.ViewMatchers.withId +import android.support.test.rule.ActivityTestRule +import android.support.test.runner.AndroidJUnit4 +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4::class) +class CrashTest { + @get:Rule + val activityRule = ActivityTestRule(CrashTestActivity::class.java, true, false) + + // adb shell am instrument -w -r -e debug false -e class ru.tinkoff.allure.CrashTest#crash ru.tinkoff.allure.test/ru.tinkoff.allure.android.AllureAndroidRunner + @Test + fun crash() { + activityRule.launchActivity(Intent(InstrumentationRegistry.getTargetContext().applicationContext, CrashTestActivity::class.java)) + onView(withId(R.id.crash_button)).perform(click()) + } + + // adb shell am instrument -w -r -e debug false -e class ru.tinkoff.allure.CrashTest#rxCrash ru.tinkoff.allure.test/ru.tinkoff.allure.android.AllureAndroidRunner + @Test + fun rxCrash() { + activityRule.launchActivity(Intent(InstrumentationRegistry.getTargetContext().applicationContext, CrashTestActivity::class.java)) + onView(withId(R.id.rx_crash_button)).perform(click()) + } +} \ No newline at end of file diff --git a/allure-android/src/espresso/AndroidManifest.xml b/allure-android/src/espresso/AndroidManifest.xml new file mode 100644 index 0000000..be1dd2d --- /dev/null +++ b/allure-android/src/espresso/AndroidManifest.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/allure-android/src/espresso/kotlin/ru/tinkoff/allure/CrashTestActivity.kt b/allure-android/src/espresso/kotlin/ru/tinkoff/allure/CrashTestActivity.kt new file mode 100644 index 0000000..9e72558 --- /dev/null +++ b/allure-android/src/espresso/kotlin/ru/tinkoff/allure/CrashTestActivity.kt @@ -0,0 +1,36 @@ +package ru.tinkoff.allure + +import android.os.Bundle +import android.support.v7.app.AppCompatActivity +import android.widget.Button +import rx.Observable +import rx.schedulers.Schedulers + +class CrashTestActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_test) + + findViewById