Issue
How does Testng plugin in jenkins interacts with selenium grid hub ?
How selenium grid hub transfers the execution test result to jenkins? what if selenium grid hub is down, can jenkins identify whether selenium grid hub is down or not ? and accordingly tell user regarding the status of selenium grid hub.
Do we need specifically separate stage to have testng results report collection ?
what's the relation of Testng plugin and testng report analyzer plugin ?
Solution
How does Testng plugin in jenkins interacts with selenium grid hub ?
TestNG Results plugin just looking for your build output (TestNG results from XML files, generated after tests execution).
So it's not related to Selenium Grid.
This is post-action in your build.
How selenium grid hub transfers the execution test result to jenkins?
Selenium Grid is just a service, which creates and manages WebDriver sessions. This is just a resource, your tests use. It is not producing any test results directly, but your code (tests) sends some requests to it and gets responses.
Summarize:
Jenkins job run command to execute tests with TestNG lib.
TestNG java library produces some output xml files based on test results.
Your tests do some actions and might interact with some services (senf HTTP-requests, connect to a database or create WebDriver sessions in Selenium Grid) - this is a special case of the implementation of your tests.
Jenkins TestNG Results plugin looks for generated output xml files to build reports.
What if selenium grid hub is down
If selenium grid is down and you interact with it in some high-level configuration stages, like @BeforeSuite
or @BeforeTest
, your configuration will failed and all the related tests will be skipped. So you might get the report with all the tests skipped.
Can jenkins identify whether selenium grid hub is down or not?
You have to implement some checks explicitly. Possible solutions:
Add pre-build action with CURL request to selenium grid in order to check its state. You might add it to the pipeline and launch selenium grid if it's not available, or exit with an error before running tests.
Implement the check in your tests. In this case, you might only skip all tests without running.
Do we need specifically separate stage to have testng results report collection?
Use post-build action as mentioned in plugin-documentation.
What's the relation of Testng plugin and testng report analyzer plugin?
They both do similar actions, but testng report analyzer plugin shows the historical data for test-results while TestNG Results plugin focused on current build results.
I'm not sure if it's possible to use them both together..
Answered By - Max Daroshchanka
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.