Genetec / azure-devops-extension-publishtestresultscreenshot

Azure DevOps extension used in CI pipeline to upload screenshot in test results report.
https://marketplace.visualstudio.com/items?itemName=Genetec.publish-test-result-screenshot
Apache License 2.0
10 stars 6 forks source link

Issues block mapping and emulator image #5

Closed PhilipChr closed 4 months ago

PhilipChr commented 3 years ago

Good evening, I would like to thank you in advance and I would position this as a starter question. I refer to the medium blog entry and I tried to solve it already by myself with your documentation.

I have integrated a UnitTest into my current project. Now I would be very happy if I could use your program in Azure. You can find the YAML file in the appendix. First I had the following problem when I didn't use your Python script but your "Screenshot Task". Encountered error(s) while parsing pipeline YAML: /azure-pipelinesUITest.yml: (Line: 47, Col: 1, Idx: 2029) - (Line: 47, Col: 2, Idx: 2030): While parsing a block mapping, did not find expected key.

Line 47 is the beggining of the task. grafik continueOnError: true

If I exclude this task there is another problem with downloading and installing the emulator image. grafik

Thank you so much!

eric-labelle commented 3 years ago

Hi! First of, to solve the emulator error is quite easy.

So, for the emulator, you can refer to android issue. Turns out they removed this image from sdk, not sure why yet the google-api version of this 28 API images has been removed, but I had swapped to system-images;android-28;default;x86 a few months back when I noticed they had removed it.

Your other problems seems to simply be a formatting error based on your screenshot. The -task: nodes needs to be aligned always, otherwise your YAML won't be parsed properly.

i.e.

- task: PublishTestResults@2
- task: Genetec.publish-test-result-screenshot.pipeline-extension.PublishTestResultScreenshot@0

Thanks

PhilipChr commented 3 years ago

Hello, thank you for your fast answer 👍 I use the emulator described over here https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/android?view=azure-devops It will install "system-images;android-27;google_apis;x86" and this works absolutely fine! There is "another" I hope the last issue .. During the Instrumented tests is a permission denied error. I would be grateful for help. grafik Just for your information the full yaml: grafik

eric-labelle commented 3 years ago

I think your problem is that you replaced the systemimage when creating the AVD, but not when you download and install the systemimage in the previous step.

echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-28;default;x86'
echo "==============> Image downloaded (system-images;android-28;default;x86)"

I chose 28:default for my usecase, but you are free to choose the version you want if you prefer to test on API29, 30 or 23 or whichever. There is plenty to chose from.

You can find all available system-images using the following command

$ANDROID_HOME/tools/bin/sdkmanager --list | grep system-images
PhilipChr commented 3 years ago

The Image is working fine 🥇 Changed to version 28 because of your tipp. grafik As described above there is the permission denied error grafik Afterwards there are no tests available, i think this is the result because of the permission denied error. grafik Screenshots of my tests: grafik

Hopefully my questions are not too stupid Thanks! Philip yaml file.txt

eric-labelle commented 3 years ago

I remember facing this error at some point but not sure what it was. You can in the meantime replace the bash task by the provided gradle task

      - bash: |
          ./gradlew connectedDebugAndroidTest --console=plain  --stacktrace
          ./gradlew --stop
        displayName: 'Run Instrumented Tests'
        continueOnError: true

by

      - task: Gradle@2
        displayName: 'Run Instrumented Tests'
        inputs:
          tasks: 'connectedDebugAndroidTest --console=plain  --stacktrace'
          publishJUnitResults: false
        continueOnError: true
PhilipChr commented 3 years ago

NOW ITS WORKING. I am excited 😄. Atleast I know if there is an error in the UITest, so I do have a response. The Screenshot is a nice to have. Finally I am moving forward to the screenshot section. The pipeline is somehow skipping the task, there is no error response or something similiar.

I tried the execution with a test (including error) and a passing. All tests passed: grafik grafik

An error in the test: grafik grafik grafik

Greetings from Germany :)

kjgen commented 4 months ago

Closing issue because the extension is being deprecated and will no longer be maintained. An alternative solution is to use the Publish Test Result task which now supports file attachments.