How to include failed screenshots into the codeception report - codeception

Just started using codeception 2.0.9 and have installed it with phantomjs and got some sample tests running.
Codeception gives a concise html report at the end that summarises passed tests in red and green, which is nice.
In the reporting directory there is also a screenshot of failed tests, e.g. ExampleCest.CheckLabel.fail.png ExampleCest.CheckLabel.fail.html
Question, how can these be (automatically) linked into report.html so that one can see the failed screenshots from the report in the browser?

Yes, there is a enhancement (#3602) to include screenshot in the report, but it's not release in the current version (2.2).
You can check this feature status at https://github.com/Codeception/Codeception/pull/3602.

Related

Screenshots are not generating for failure cases using robot framework if i am doing execution through Jenkins in Linux slave

In Robot framework by default screenshots are generating for failure cases.I tried using Get page screenshot keyword, but still i can't see screenshots. Using the same script i can see screenshots if i am doing the execution in local machine.
I am executing with headless chrome in Linux slave with Jenkins. Same scripts are working in local but failing in Jenkins. I want to see screenshots for failures, but screenshots are not generating.
Input Text ${login_password} ${password}
capture page screenshot password.png
click on next ${password_next} ${login_password}
capture page screenshot next.png
It is giving broken image like below.
I tried with below script to store the screenshots. It is working in Local. But screenshots are generating but not coming in html report if i m doing execution in Jenkins server which is hosted in Linux.
Capture Image
[Arguments] ${imagename}
${path}= Catenate SEPARATOR= ${EXECDIR} / Screenshots / ${imagename} . png
capture page screenshot ${path}
Issue Resolved. I am using Robot plugin in Jenkins for results. In Post build configuration till the time i am allowing only log and html report. but now i updated that as to allow .png format files also. So, default it is giving screenshots for failuree.

Display selenese-runner results in Jenkins

As I am implementing an automated way to GUI test our webapplication with selenium I ran into some issues.
I am using selenese-runner to execute our Selenium test suites, created with Selenium IDE as a post build action in Jenkins.
This works perfeclty fine, as the build fails when something is wrong, and the build succeeds if all tests are passed. And the results are stored on a per build basis as HTML files, generated be selenese-runner.
My problem is however, that I seem to be unable to find a way, how to display these results in the respective jenkins build.
Does anyone have an idea how to solve this issue. Or maybe I am on the wrong path at all?
Your help is highly appreciated!
I believe the JUnit plugin should do what you want, but it doesn't work for me.
My config uses this shell script to run the tests (you can see the names of all my test suites):
/usr/bin/Xvfb &
export DISPLAY=localhost:0.0
cd ${WORKSPACE}
java -jar ./test/selenium/bin/selenese-runner.jar --baseurl http://${testenvironment} --screenshot-on-fail ./seleniumResults/ --html-result ./seleniumResults/ ./test/selenium/Search_TestSuite.html ./test/selenium/Admin_RegisteredUser_Suite.html ./test/selenium/Admin_InternalUser_Suite.html ./test/selenium/PortfolioAgency_Suite.html ./test/selenium/FOAdmin_Suite.html ./test/selenium/PublicWebsite_Suite.html ./test/selenium/SystemAdmin_Content_Suite.html ./test/selenium/SystemAdmin_MetaData_Suite.html
killall Xvfb
And I can see the result of the most recent test (you can see the name of my jenkins task folder)
http://<JENKINS.MY.COMPANY>/job/seleniumRegressionTest/ws/seleniumResults/index.html
Earlier tests are all saved on the Jenkins server, so I can view them if I need to.

Codeception Screenshots on test pass

I see that Codeception takes screenshots if a test fails, is there anyway to make it take screenshots if the tests pass too?
For info, we're using the phantomjs WebDriver.
The best documentation for this I've found is for the WebDriver module
In there there's a description of makeScreenshot() which allows you to take a screenshot at any given point of your tests. It appears that it will put all of the screenshots in one directory so better think about a good naming convention.
Alternatively, we've now got the Recorder extension working which automates the process of taking screenshots at every test step and presents them in a useful report.
You can use Recorder extension with option delete_successful in configuration acceptance.suite.yml (in extensions: part, not modules:)
extensions:
enabled:
- Codeception\Extension\Recorder:
delete_successful: false # keep screenshots of successful tests
Quote from documentation about Recorder and PhantomJS:
Since PhantomJS doesn’t give you any visual feedback, it’s probably a good idea to install Codeception\Extension\Recorder which gives you screenshots of how PhantomJS “sees” your pages.
More information you can find in documentation for Recorder extension: http://codeception.com/extensions#Recorder
How to find screenchots
Results of the last test running you can find in a file _output/records.html. The file contains links to slideshows with screenshots for each test. Just reload the page after the test.

Viewing test failed results bamboo 4.4.4

I have problem in Bamboo 4.4.4:
I've created plan which start some tests and then it generate TestReport.xml.TestReport
I try to parse it with JUnit Parser, but in Test Results Bamboo show only successfull tests and not even one failed.
Any suggestions?
P.S. I atached generated my TestReport.xml and xml-file, that created Bamboo after parse.buildresults19.txt
If your having issues with getting the tests to report correctly please contact Atlassian Support - they can help you sort it out quicker than Stack Overflow!
Thanks
James Dumay
Bamboo Product Manager

play auto-test selenium test failed, no test-result TEST-{testname}.xml file generated

We have a Play (1.2.4) application which is auto-tested via our Teamcity server. The regular (JUnit) tests return a Test-{classname}.xml datafile in the /test-result/ directory when using
play.bat auto-test
but the selenium tests do not. They only generate a /test-result/{testname}.test.html.failed.html or ...succes.html
This is annoying because i can not easily show which selenium test has failed from within Teamcity. I have to look at the logfiles/artifacts and see which failed.html file is present, open it and look at it which testcase has failed. Annoying!
How can i have play 1.2.4 generate a datafile/xml something which i can parse to see which selenium test has failed?
Since i could find no information what so ever and no clue's how to get it done i wrote my own parsers of the Selenium HTML testresult files. I have released it on github with sourcecode under GPL: https://github.com/crunchie84/play-seleniumresults-parser