KasperskyLab / Kaspresso

Android UI test framework
https://kasperskylab.github.io/Kaspresso/
Apache License 2.0
1.78k stars 150 forks source link

"Could not create Allure results directory" error and no Allure report created. #490

Closed matale closed 1 year ago

matale commented 1 year ago

Describe the bug No Allure report file is written to device. Video, logcat and screenshots are saved to Documents directory but there is no Allure report. I am using the basic kaspressoBuilder = Kaspresso.Builder.withAllureSupport()

To Reproduce Steps to reproduce the behavior:

  1. Run tests in project https://github.com/matale/KaspressoSimpleTestAllureSample
  2. Check Documents folder on device
  3. No Allure report but video, screenshots and logcat is there.
  4. There is an error in logcat, I will also attach the rest of the logcat. TestLogcat.txt

12:58:06.746 8196 8221 E KASPRESSO: An error while making screenshot occurred: io.qameta.allure.kotlin.AllureResultsWriteException: Could not create Allure results directory Line 20: 02-11 12:58:06.746 8196 8221 E KASPRESSO: at io.qameta.allure.kotlin.FileSystemResultsWriter.createDirectories(FileSystemResultsWriter.kt:64) Line 21: 02-11 12:58:06.746 8196 8221 E KASPRESSO: at io.qameta.allure.kotlin.FileSystemResultsWriter.write(FileSystemResultsWriter.kt:45) Line 22: 02-11 12:58:06.746 8196 8221 E KASPRESSO: at io.qameta.allure.kotlin.AllureLifecycle.writeAttachment(AllureLifecycle.kt:497) Line 22: 02-11 12:58:06.746 8196 8221 E KASPRESSO: at io.qameta.allure.kotlin.AllureLifecycle.writeAttachment(AllureLifecycle.kt:497) Line 22: 02-11 12:58:06.746 8196 8221 E KASPRESSO: at io.qameta.allure.kotlin.AllureLifecycle.writeAttachment(AllureLifecycle.kt:497) Line 23: 02-11 12:58:06.746 8196 8221 E KASPRESSO: at io.qameta.allure.kotlin.AllureLifecycle.addAttachment(AllureLifecycle.kt:453) Line 23: 02-11 12:58:06.746 8196 8221 E KASPRESSO: at io.qameta.allure.kotlin.AllureLifecycle.addAttachment(AllureLifecycle.kt:453) Line 23: 02-11 12:58:06.746 8196 8221 E KASPRESSO: at io.qameta.allure.kotlin.AllureLifecycle.addAttachment(AllureLifecycle.kt:453) Line 24: 02-11 12:58:06.746 8196 8221 E KASPRESSO: at com.kaspersky.components.alluresupport.files.AttachToReportKt.attachScreenshotToAllureReport(AttachToReport.kt:20) Line 24: 02-11 12:58:06.746 8196 8221 E KASPRESSO: at com.kaspersky.components.alluresupport.files.AttachToReportKt.attachScreenshotToAllureReport(AttachToReport.kt:20) Line 25: 02-11 12:58:06.746 8196 8221 E KASPRESSO: at com.kaspersky.components.alluresupport.interceptors.step.ScreenshotStepInterceptor$intercept$1.invoke(ScreenshotStepInterceptor.kt:21) Line 26: 02-11 12:58:06.746 8196 8221 E KASPRESSO: at com.kaspersky.components.alluresupport.interceptors.step.ScreenshotStepInterceptor$intercept$1.invoke(ScreenshotStepInterceptor.kt:21) Line 29: 02-11 12:58:06.746 8196 8221 E KASPRESSO: at com.kaspersky.components.alluresupport.interceptors.step.ScreenshotStepInterceptor.intercept(ScreenshotStepInterceptor.kt:21) Line 30: 02-11 12:58:06.746 8196 8221 E KASPRESSO: at com.kaspersky.components.alluresupport.interceptors.step.ScreenshotStepInterceptor.interceptAfterWithSuccess(ScreenshotStepInterceptor.kt:13)

Expected behavior Expect to find allure report in Documents

Smartphone (please complete the following information): Emulator Google API, Android 33

Additional context I have tried various combinations with the permissions with no success. Also video, logcat, screenshots seem to work even without any permissions.

Nikitae57 commented 1 year ago

Hi, @matale! Thank you for your submission! I've checked your sample. To fix this issue, please, do the following:

  1. Update kaspresso to 1.5.2
  2. Use withForcedAllureSupport() builder
  3. Set kaspresso runner (replace androidx.test.runner.AndroidJUnitRunner with com.kaspersky.kaspresso.runner.KaspressoRunner)