Junit Attachment Plugin

950 views
Skip to first unread message

ak...@dealerfire.com

unread,
Jan 9, 2014, 9:24:45 AM1/9/14
to jenkins...@googlegroups.com

Hi everybody.

Need help with configuration of JUnit xml, for JUnit attachment plugin.


I've done stdout with [[ATTACHMENT|/absolute/path/to/some/file]]
But nothing appeared in test class results.

Image exist in directory but it's not attached to failed test.

What i did wrong?



testReport.png

Daniel Beck

unread,
Jan 9, 2014, 11:30:09 AM1/9/14
to jenkins...@googlegroups.com
The parsing rules were relaxed since the latest release of Junit Attachment plugin. Maybe build the plugin and see whether that fixes the issue.
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
> <testReport.png>

ak...@dealerfire.com

unread,
Jan 9, 2014, 11:45:35 AM1/9/14
to jenkins...@googlegroups.com, m...@beckweb.net
Sorry, didn't get the main idea.

Plugin was installed and it's latest version.
And it's say nothing bad after build. Just saying 

Build step 'Publish JUnit test result report' changed build result to UNSTABLE

Unstable, because of fail test.
Still can't understand what i'm missing.

Daniel Beck

unread,
Jan 9, 2014, 12:30:27 PM1/9/14
to jenkins...@googlegroups.com
Message has been deleted

ak...@dealerfire.com

unread,
Jan 10, 2014, 8:41:44 AM1/10/14
to jenkins...@googlegroups.com, m...@beckweb.net
Thanks for latest version

 
Now jenkins console output says that:

Started by user anonymous
Building in workspace /var/lib/jenkins/jobs/ignite2autotest/workspace
Fetching changes from the remote Git repository
Fetching upstream changes from file:///home/kimandrew/PycharmProjects/TestFramework
Checking out Revision b0953593b3c8848a37196ebcf01d6717c43eb954 (origin/optimization)
Xvfb starting$ Xvfb :3 -screen 0 1366x768x24 -fbdir /var/lib/jenkins/2014-01-10_16-44-203342596046232664267xvfb
[workspace] $ /bin/sh -xe /tmp/hudson504829984443284425.sh
+ python run.py -t schedule

Running tests...
----------------------------------------------------------------------
  test_delete_service (schedule.test_schedule.Schedule) ... [[ATTACHMENT|/var/lib/jenkins/jobs/ignite2autotest/workspace/test-results/2014-01-10_16-45-33.jpg]]ERROR (50.690s)
  test_delete_testdrive (schedule.test_schedule.Schedule) ... [[ATTACHMENT|/var/lib/jenkins/jobs/ignite2autotest/workspace/test-results/2014-01-10_16-46-05.jpg]]ERROR (32.417s)
  test_service (schedule.test_schedule.Schedule) ... OK (43.050s)
  test_testdrive (schedule.test_schedule.Schedule) ... OK (39.857s)

======================================================================
ERROR [50.690s]: test_delete_service (schedule.test_schedule.Schedule)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/lib/jenkins/jobs/ignite2autotest/workspace/test/__init__.py", line 20, in wrapper
    f(self)
  File "/var/lib/jenkins/jobs/ignite2autotest/workspace/test/schedule/test_schedule.py", line 61, in test_delete_service
    back_end.driver.find_element_by_partial_link_text(self.customer_fields['FirstName']).click()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 270, in find_element_by_partial_link_text
    return self.find_element(by=By.PARTIAL_LINK_TEXT, value=link_text)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 680, in find_element
    {'using': by, 'value': value})['value']
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 165, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response
    raise exception_class(message, screen, stacktrace)
NoSuchElementException: Message: u'Unable to locate element: {"method":"partial link text","selector":"kNCsouv"}' ; Stacktrace: 
    at FirefoxDriver.prototype.findElementInternal_ (file:///tmp/tmpb5Sw9W/extensions/fxdr...@googlecode.com/components/driver_component.js:8899)
    at FirefoxDriver.prototype.findElement (file:///tmp/tmpb5Sw9W/extensions/fxdr...@googlecode.com/components/driver_component.js:8908)
    at DelayedCommand.prototype.executeInternal_/h (file:///tmp/tmpb5Sw9W/extensions/fxdr...@googlecode.com/components/command_processor.js:10840)
    at DelayedCommand.prototype.executeInternal_ (file:///tmp/tmpb5Sw9W/extensions/fxdr...@googlecode.com/components/command_processor.js:10845)
    at DelayedCommand.prototype.execute/< (file:///tmp/tmpb5Sw9W/extensions/fxdr...@googlecode.com/components/command_processor.js:10787) 

======================================================================
ERROR [32.417s]: test_delete_testdrive (schedule.test_schedule.Schedule)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/lib/jenkins/jobs/ignite2autotest/workspace/test/__init__.py", line 20, in wrapper
    f(self)
  File "/var/lib/jenkins/jobs/ignite2autotest/workspace/test/schedule/test_schedule.py", line 72, in test_delete_testdrive
    back_end.driver.find_element_by_partial_link_text(self.customer_fields['FirstName']).click()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 270, in find_element_by_partial_link_text
    return self.find_element(by=By.PARTIAL_LINK_TEXT, value=link_text)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 680, in find_element
    {'using': by, 'value': value})['value']
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 165, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response
    raise exception_class(message, screen, stacktrace)
NoSuchElementException: Message: u'Unable to locate element: {"method":"partial link text","selector":"MBXQlzr"}' ; Stacktrace: 
    at FirefoxDriver.prototype.findElementInternal_ (file:///tmp/tmpb5Sw9W/extensions/fxdr...@googlecode.com/components/driver_component.js:8899)
    at FirefoxDriver.prototype.findElement (file:///tmp/tmpb5Sw9W/extensions/fxdr...@googlecode.com/components/driver_component.js:8908)
    at DelayedCommand.prototype.executeInternal_/h (file:///tmp/tmpb5Sw9W/extensions/fxdr...@googlecode.com/components/command_processor.js:10840)
    at DelayedCommand.prototype.executeInternal_ (file:///tmp/tmpb5Sw9W/extensions/fxdr...@googlecode.com/components/command_processor.js:10845)
    at DelayedCommand.prototype.execute/< (file:///tmp/tmpb5Sw9W/extensions/fxdr...@googlecode.com/components/command_processor.js:10787) 

----------------------------------------------------------------------
Ran 4 tests in 166.015s

FAILED (errors=2)

Generating XML reports...
Xvfb stopping
Recording test results
Attachment /var/lib/jenkins/jobs/ignite2autotest/workspace/test-results/2014-01-10_16-45-33.jpg]][[ATTACHMENT was referenced from the test 'schedule.test_schedule.Schedule-20140110164444' but it doesn't exist. Skipping.
Build step 'Publish JUnit test result report' changed build result to UNSTABLE
Finished: UNSTABLE
 
What does it mean?
JUnit report and screenshot, both are exist.

My python code which writing stderr looks like this.

sys.stderr.write('[[ATTACHMENT|'+screenshot_dir+'/%s.jpg' % now_time+']]')



ak...@dealerfire.com

unread,
Jan 10, 2014, 8:56:55 AM1/10/14
to jenkins...@googlegroups.com, m...@beckweb.net
If i'm doing stderr, should I use same directory with report.xml file?

ak...@dealerfire.com

unread,
Jan 11, 2014, 4:09:50 PM1/11/14
to jenkins...@googlegroups.com, m...@beckweb.net
Now console output has this text after tests.

Generating XML reports...
Xvfb stopping
Recording test results
Build step 'Publish JUnit test result report' changed build result to UNSTABLE
Finished: UNSTABLE


But Test Result still doesn't have any attachments.
Now I think this plugin is not working.
Is there any plugin instead of this? 



metalmo...@gmail.com

unread,
Feb 5, 2014, 5:53:59 AM2/5/14
to jenkins...@googlegroups.com, m...@beckweb.net
I had the same isssues as you did. Couldn't find a proper example of the Junit XML file. Finally made it work. Maybe XML example below might help
 
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="suite01">
<testcase classname="tc01.xml" name="tc01-description" time="0.698">
</testcase>
<testcase classname="tc02.xml" name="tc02-description" time="0.609">
<failure message="Some Failure occurred">Failure info</failure>
<system-out>[[ATTACHMENT|C:/path/to/file.jpg]]</system-out>
</testcase>
<testcase classname="tc03.xml" name="tc03-description" time="2.712">
<failure message="Some Failure occurred">Failure info</failure>
<system-out>
[[ATTACHMENT|C:/path/to/file2.jpg]]
[[ATTACHMENT|C:/path/to/file3.jpg]]
</system-out>
</testcase>
</testsuite>



JonathanRRogers

unread,
Feb 5, 2014, 5:22:25 PM2/5/14
to jenkins...@googlegroups.com, m...@beckweb.net

Thanks for the example. What isn't explained in the docs and HOWTO for the Jenkins plugin is that it looks for attachments in the <system-out> element. I'm using nose's XUnit plugin, which doesn't produce that element. I got the behavior I wanted by extending the nose XUnit plugin to add <system-out>.

metalmo...@gmail.com

unread,
Feb 6, 2014, 7:44:24 AM2/6/14
to jenkins...@googlegroups.com, m...@beckweb.net


Op woensdag 5 februari 2014 23:22:25 UTC+1 schreef JonathanRRogers:
In addition, the <system-err> element also does the job.
Reply all
Reply to author
Forward
0 new messages