Playwright - How to access test results before running globalTeardown - playwright

In Playwright, after all tests have been executed, I am running a globalTeardown file that would send all of the test results to an external test management tool by making a series of api calls.
My intention was to access the jUnit.xml file and get the temporary test results from there, but the problem is that that file doesn't generate until the entire run is over, which is after the globalTeardown call.
Is there a way with Playwright to access the temporary test results, before the run is over?

Related

Playwright: Running certain files parallel and others serial in

I've created a few tests for my project, some test need to be run async while others can run sync.
Currently the config file is set to run async.
I've set a test file which runs them in the correct order. I've imported all the tests that should run sync into a single file. And tried adding
test.describe.configure({ mode: 'parallel' })
This changes the whole test process to run in parallel.
I can't seem to find any documentation on how to only execute certain test async and other sync. Does anyone have experience with this?
The reason I need it to run async for certain files is to log in and authenticate before continuing, also certain actions affect the layout of the whole UI (even in a different browser) and will mess up other tests screenshots.
PW runs all test in parallel by default. But there are options to serialize tests per file. You cannot have both paralel and serial tests in one file.
https://playwright.dev/docs/test-parallel#serial-mode

Getting access to the allure report statistics in Jenkins (tests with Webdriverio)

I have a set of tests which run within Jenkins and at the end of the tests (in the post section) I generate an allure report. The tests are created with Webdriverio.
The last time I did anything like this, I was using standard selenium running with Junit and due to that combination, the Jenkins Rest API had access to things like failedCount, skipCount, passes and failed counts. This however seems to only be possible with JUnit.
Does allure expose this to Jenkins somehow - or am I going to have to try and scrape the statistics from a pre-generated report?
(as a side note, I have tried to configure a second reporter in webdriverio, but while that seems to create some xml files locally, the folder I configure is not appearing on Jenkins. Also, webdriverio doesn't support JUnit as a framework - currently it's using mocha.)
I eventually managed to figure this out.
There is url which you can go to to get a json file with the summary information.
So if you report is at /allure - then you navigate to /widgets/summary.json

generating jacoco code coverage for remote server

I will explain the scenario which I got struck.
I have made the B2B setup through docker image which I cant access because it is remote one.I want to generate the code coverage using jacoco in jenkins.Now I want to do everything in docker host.Before running testng data ,I need to update the wrapper file for the integration server to get the report. how to get the exec data and instrumented classes to get the code coverage in the remote location.
In my server,I have already compiled class files.I am using tcp remote server mode to collect the data.I want the code coverage for those two class files and I have included those but am getting zero percentage code coverage.I am using external port corresponding to the tcp internal port to collect the data.

Cucumber-jvm #after with Appium driver

I'm using cucumber-jvm , and trying to implement global #After method which should be executed only once after all scenario's execution was completed.
The #After method should quit the appium driver.
Currently #After hook being executed after each running scenario , and it means that the driver should be created each time from scratch , but I do want to reuse it.
Any help will be much appreciated
You can try using QAF which support Gherkin, where driver management is taken care by the framework. It is dedicated framework built upon TestNG for web, mobile web, mobile native, and webservices functional test automation.
When using QAF you don't need to write any code to setup/teardown driver. You can configure as per your need through testng xml configuration file and properties. You can specify behavior by using property selenium.singletone. For example:
#will reuse driver session for close browser after all testcase configured under xml test node
selenium.singletone=true
#will teardown after each scenario/testcase
selenium.singletone=Method
#will reuse driver session for group
selenium.singletone=Groups
If you are running in parrallel it will you can have driver session sharing between test running in same thread. All combinations you can achieve through execution configuration.
Moreover, you can use all TestNG listener and annotations. For example:
#BeforeMethod:Invokes Before each Testcase/Scenario
#BeforeSuite: Invokes once before entire suite
#BeforeTest: Invokes once before each xml test node for each xml test node in configuration
#BeforeGroup: Invokes once before starting execution of test in group for each group
#AfterSuite: Invokes once after entire suite
#AfterTest: Invokes once after entire xml test node
#AfterGroup:Invokes once after all test in group for each group
#AfterMethod:Invokes after each Testcase/Scenario
Refer Gherkin with QAF

HTTP access to on-going Jenkins build files

I guess the title is pretty self-explanatory. The reason I want that is so that I can make a live custom HTML reporter for my tests.
My test suite takes hours to complete, and although the tests generate HTML reports as soon as each test step is executed, it's only at post-build time that those report files get published.
Being able to see them as they get generated would reduce the time it takes for me and my teammates to analyze and act upon issues revealed by our test runs.
All I need is that Jenkins let me access the build files as the build executes. Nothing fancy; I can take care of the rest. Is that possible? How?
In our setup there is always an intermediate file (typically XML) but the HTML files are created at the end of the job.
What you can do, is use the progressive output (http://jenkins/job/jobName/buildNumber/logText/progressiveText?start=0). Although you don't state which framework you use, most of them output something that would be easy to parse. e.g. "Test xxx failed".

Resources