Using IBM JUnit Selenium adapter on RQM 4.0
Leandro trevis (37●9●13)
| asked Aug 08 '12, 8:39 a.m.
retagged Aug 10 '12, 8:02 a.m. by Nhi P Ta (188●4●10●18)
Hi, I've almost successfully configured the JUnit Selenium adapter running with my RQM 4 test environment.
I can run the test class and return the results.
The only problem is that the error printscreen is not returning with the test results in RQM.
I've had followed the instructions on
Is there any extra config I need to do in order to get the printscreen when some test fails?
|
Accepted answer
Thomas Neal (141●1●3●3)
| answered Aug 09 '12, 12:39 p.m.
JAZZ DEVELOPER edited Aug 13 '12, 9:15 a.m.
Hi Leandro, if your JUnit Selenium testcase is taking screenshots and you want to attach them to the execution result you can do this by writing the screenshot file to the directory specified by the Java System property named "selenium.screenshot.dir". After each JUnit test is executed this directory is scanned for new image files and any found are attached to the execution result and associated with the corresponding test. You could create a small method like the following to do this.
private void takeScreenShot(String fname) throws Exception { File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); String imageFileDir = System.getProperty("selenium.screenshot.dir"); if (imageFileDir == null) imageFileDir = System.getProperty("java.io.tmpdir"); FileUtils.copyFile(scrFile, new File(imageFileDir, fname)); } The details about selenium.screenshot.dir missed getting into the RQM 4.0 documentation but should be present in the 4.0.0.1 version of the docs. Note that the adapter will only look for image files, ie. files with the following suffixes, .png, .jpg, .jpeg, .gif, .tif, .bmp. Be sure the names you specify include one of these. Leandro trevis selected this answer as the correct answer
|
5 other answers
Thanks Thomas,
I used the code above and succesfully wrote screenshot files on selenium.screenshot.dir. But the adapter is not uploading these images within the results.
On the result report on RQM the colum Screen capture remains empty.
Can this be an issue with the adapter, wich is fairly new? Is there any patch or new version planned for this adapter?
tks!
|
Thomas Neal (141●1●3●3)
| answered Aug 10 '12, 12:38 p.m.
JAZZ DEVELOPER edited Aug 10 '12, 12:52 p.m.
Leandro,
Do you see any messages in the shell window where you started the JUnit Selenium adapter? If everything is working correctly, you should see something similar to the following in the Result Details section of the Execution Result. You mention a column named "Screen capture", it should say "Screenshots", is that what you meant? (The image of the Execution Result I included in the comment editor is not showing up after I post) |
yes that is it! The files did not have extension (linux) so I forced a '.png' and it worked
Thanks!
|
Hi
yes I guess it is Screenshots column, I did day screnn capture because I'm using a translated version 'Capturas de tela' :-) In the shell windows when the test runs shows: Progress: 0: Executing test: test(com.mypackage.Test1) ExitCode: 0 |
What are you naming your screenshot file(s)? I should have mentioned that the adapter is looking only for image files, ie. files with the following suffixes, .png, .jpg, .jpeg, .gif, .tif, .bmp
Be sure the filename(s) you specify has one of those suffixes. |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.