Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Using IBM JUnit Selenium adapter on RQM 4.0

 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?

1

1 vote


Accepted answer

Permanent link
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

1 vote


5 other answers

Permanent link
 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!

1 vote


Permanent link
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)


1 vote


Permanent link
 yes that is it! The files did not have extension (linux) so I forced a '.png' and it worked

Thanks!

1 vote


Permanent link
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


0 votes


Permanent link
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.

0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 6,121
× 14

Question asked: Aug 08 '12, 8:39 a.m.

Question was seen: 7,756 times

Last updated: Aug 13 '12, 2:59 p.m.

Confirmation Cancel Confirm