Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blue Ocean TestResult Extension #26

Merged
merged 7 commits into from
Jan 20, 2020
Merged

Conversation

bbara
Copy link
Contributor

@bbara bbara commented Sep 6, 2019

Hey,

targeting JENKINS-40220.
Additionally, some small (and also optional) modernizations (using Java 8, ...) are added.

What do you think about it?

BR,
BB

@bbara bbara force-pushed the JENKINS-40220 branch 3 times, most recently from 8746fee to e943f12 Compare September 8, 2019 20:10
@bbara bbara changed the title [WIP] Blue Ocean TestResult Extension Blue Ocean TestResult Extension Sep 8, 2019
@bbara
Copy link
Contributor Author

bbara commented Sep 9, 2019

I will try to add some XPath tests on the BlueOcean page too (as soon as I find some time).

@Tattoo
Copy link
Member

Tattoo commented Sep 9, 2019

I think it's a good idea. Thanks for contributing! Please highlight eg. me when you feel the PR starts to be feature-ready :)

@bbara
Copy link
Contributor Author

bbara commented Sep 9, 2019

I'm not sure why I am getting this problem:

4.251 [id=821] SEVERE c.g.h.WebConsole$DefaultLogger#error: Error initializing Jenkins JavaScript bundle "jenkins-design-language" ReferenceError: Assignment to undefined "warning" in strict mode

which results to

requires JavaScript to function properly, please enable JavaScript or use a browser which supports it.

When I set a breakpoint and visit the given page, it seems like there is no problem at all...
Unfortunately, I cannot find any BlueOcean tests involving HtmlUnit.

However, I found the BlueOcean Acceptance Tests with some useful helpers, but these are not exposed anywhere.
So maybe I have to ask one of the BlueOcean maintainers what's the best practice to implement such a test...

Move to Java 8.
Move to current Jenkins LTS version.
Extract and update dependencies.
Add BlueOcean as optional dependency.
Turn on Spotbugs and git pre-commit hook
(formatting, inactive for now).
Tests crash when listener is null.
Targets JENKINS-40220.
Extension that allows to see the RF test results in Blue Ocean.
ListViewColumn actually gets the Item, not the Job [1].
Since a Folder is not an instance of a Job, but of Item [2],
it was previously "ignored" and a robot result was shown.
This commit fixes this.

[1] https://javadoc.jenkins.io/hudson/views/ListViewColumn.html
[2] https://javadoc.jenkins.io/plugin/cloudbees-folder/com/cloudbees/hudson/plugins/folder/Folder.html
@bbara
Copy link
Contributor Author

bbara commented Sep 18, 2019

Couldn't get the XPath test running with Jenkins' HtmlUnit.
Got it running with different test libs but I think adding them would be an overkill.
I think it should be sufficient to test against the provided interface of Blue Ocean anyways.

Added two additional commits regarding the usability (not related to the original PR):
First is that the robot result column is suppressed at Folder items.
Second is that the robot project action is shown at Pipeline projects (which do not extend the AbstractJob class).

@Tattoo just tell me if some more actions (except removing the test force commits) are required to get it merged :) If required, I could also move the two unrelated commits to a new PR.

@nickbroon
Copy link

It would be great to see this BlueOcean support merged.

@asimell
Copy link
Contributor

asimell commented Jan 20, 2020

@bbara This looks good. Thanks for the PR!

As a general guideline, I would appreciate separating different functionalities into separate PRs, but I'll let it pass this time. :)

@asimell asimell merged commit 7e92c74 into jenkinsci:master Jan 20, 2020
@DirkRichter
Copy link
Contributor

found a regression in this PR, which is solved by rollback to Version 2.0.1:

D:\Jenkins\workspace\DMM-CID_dev>exit 0 Robot results publisher started... -Parsing output xml: Failed! java.io.IOException: Parsing of output xml failed! at hudson.plugins.robot.RobotParser$RobotParserCallable.invoke(RobotParser.java:104) at hudson.plugins.robot.RobotParser$RobotParserCallable.invoke(RobotParser.java:54) at hudson.FilePath.act(FilePath.java:1075) at hudson.FilePath.act(FilePath.java:1058) at hudson.plugins.robot.RobotParser.parse(RobotParser.java:49) at hudson.plugins.robot.RobotPublisher.parse(RobotPublisher.java:221) at hudson.plugins.robot.RobotPublisher.perform(RobotPublisher.java:243) at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690) at hudson.model.Build$BuildExecution.post2(Build.java:186) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635) at hudson.model.Run.execute(Run.java:1878) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:427) Caused by: javax.xml.stream.XMLStreamException: Illegal xml input. Could not find end of element status. Unexpected end of element kw (at line: 36 column: 1) at hudson.plugins.robot.RobotParser$RobotParserCallable.xmlException(RobotParser.java:179) at hudson.plugins.robot.RobotParser$RobotParserCallable.ignoreUntilEnds(RobotParser.java:251) at hudson.plugins.robot.RobotParser$RobotParserCallable.processTest(RobotParser.java:313) at hudson.plugins.robot.RobotParser$RobotParserCallable.processSuite(RobotParser.java:155) at hudson.plugins.robot.RobotParser$RobotParserCallable.processSuite(RobotParser.java:153) at hudson.plugins.robot.RobotParser$RobotParserCallable.processSuite(RobotParser.java:153) at hudson.plugins.robot.RobotParser$RobotParserCallable.parseResult(RobotParser.java:123) at hudson.plugins.robot.RobotParser$RobotParserCallable.invoke(RobotParser.java:99) ... 16 more Build step 'Publish Robot Framework test results' changed build result to FAILURE

@bbara
Copy link
Contributor Author

bbara commented Feb 25, 2020

Hey @DirkRichter,
could you maybe provide me an example output.xml or some relevant lines around the given problematic line 36?
I will take a look into that.

@DirkRichter
Copy link
Contributor

here a sample line 35 and line 36 from output.xml:

<status status="PASS" starttime="20200225 14:33:12.060" endtime="20200225 14:33:12.060"></status>
</kw>

the status element is correctly closed in line 35. it looks like the new robot plugin do no longer understand the closing tag?

here the head of output.xml:

<?xml version="1.0" encoding="UTF-8"?>
<robot generator="Rebot 3.1.2 (Python 3.7.3 on win32)" generated="20200225 14:33:25.457" rpa="false">
<suite id="s1" name="Tests" source="D:\CID.Artemis\Files\NTA\Robot\Tests">
<suite id="s1-s1" name="CID" source="D:\CID.Artemis\Files\NTA\Robot\Tests\CID">
<suite id="s1-s1-s1" name="SelfTests" source="D:\CID.Artemis\Files\NTA\Robot\Tests\CID\SelfTests.robot">
<test id="s1-s1-s1-t1" name="ChromeDriverVerification">
<kw name="SetDocumentation" library="Settings" type="setup">
<msg timestamp="20200225 14:33:12.060" level="TRACE">Arguments: [  ]</msg>
<kw name="Set Variable" library="BuiltIn">
<doc>Returns the given values which can then be assigned to a variables.</doc>
<arguments>
<arg>env:${ENV} - browser:${BROWSER} - publicationCheckMode:${PublicationCheckMode}</arg>
</arguments>
<assign>
<var>${docu}</var>
</assign>
<msg timestamp="20200225 14:33:12.060" level="TRACE">Arguments: [ 'env:dev - browser:chrome - publicationCheckMode:all_entities_in_VoD.Publication+Dummy' ]</msg>
<msg timestamp="20200225 14:33:12.060" level="TRACE">Return: 'env:dev - browser:chrome - publicationCheckMode:all_entities_in_VoD.Publication+Dummy'</msg>
<msg timestamp="20200225 14:33:12.060" level="INFO">${docu} = env:dev - browser:chrome - publicationCheckMode:all_entities_in_VoD.Publication+Dummy</msg>
<status status="PASS" starttime="20200225 14:33:12.060" endtime="20200225 14:33:12.060"></status>
</kw>
<kw name="Set Variable If" library="BuiltIn">
<doc>Sets variable based on the given condition.</doc>
<arguments>
<arg>'${SELENIUM_GRID_URL}'!=''</arg>
<arg>${docu} - grid:${SELENIUM_GRID_URL}</arg>
<arg>${docu}</arg>
</arguments>
<assign>
<var>${docu}</var>
</assign>
<msg timestamp="20200225 14:33:12.060" level="TRACE">Arguments: [ "''!=''" | '${docu} - grid:${SELENIUM_GRID_URL}' | '${docu}' ]</msg>
<msg timestamp="20200225 14:33:12.060" level="TRACE">Return: 'env:dev - browser:chrome - publicationCheckMode:all_entities_in_VoD.Publication+Dummy'</msg>
<msg timestamp="20200225 14:33:12.060" level="INFO">${docu} = env:dev - browser:chrome - publicationCheckMode:all_entities_in_VoD.Publication+Dummy</msg>
<status status="PASS" starttime="20200225 14:33:12.060" endtime="20200225 14:33:12.060"></status>
</kw>

@asimell
Copy link
Contributor

asimell commented Feb 26, 2020

@DirkRichter Which Robot Framework version are you using? Could you also consider creating a new issue for this?

@DirkRichter
Copy link
Contributor

robotframework==3.1.2

@DirkRichter
Copy link
Contributor

@asimell
Copy link
Contributor

asimell commented Feb 26, 2020

Thank you. Let us continue discussion there, instead of a closed PR :)

@bbara bbara mentioned this pull request Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants