Output selenium test result as html after running perl script - perl

I am currently looking for a way to output the test result nicely after running selenium perl script.
The htmlSuite command from running selenium server outputs a nice html format result page, but I don't know how to do that in perl script.
Problem is, I have it setup so that Selenium is being run 24/7 on a virtual machine workstation(Windows 7), where anyone one can run tests on. Therefore I can't use htmlSuite to run the test because the server will close after the test is finished.
Is there a command argument or perl script method to make selenium server output results on html or other nice format other than printing it on the command line?
Or is there a better way to do this?

If your script is output TAP (that's what Test::More would put out), then you can use the Test::Harness family of modules to parse that TAP and use it to generate an HTML report.

How nice is nice? Under Hudson/Jenkins this gives graphs and a tabular report of tests run:
prove --timer --formatter=TAP::Formatter::JUnit large_test.t >junit.xml

Related

How to test a single failing test when building perl

This issue usually is encountered when trying to run make test and sees one test fails. The README describes one can run each test individually, didn't clearly specifies how to do so.
make test uses the script called TEST in the test directory (t). To replicate make test of a single file, one would use this script as follows:
[.../perl/t]$ ./perl -I../lib TEST op/array.t
t/op/array ... ok
All tests successful.
Elapsed: 0 sec
u=0.01 s=0.00 cu=0.03 cs=0.02 scripts=1 tests=194
If you want to see the raw output of the test script, you can run perl as follows:
[.../perl/t]$ ./perl -I../lib op/array.t
1..194
ok 1
ok 2
ok 3
...
ok 192 - holes passed to sub do not lose their position (multideref, mg)
ok 193 - holes passed to sub do not lose their position (aelem)
ok 194 - holes passed to sub do not lose their position (aelem, mg)
The above information and more is found in perlhack.
This document explains how Perl development works. It includes details about the Perl 5 Porters email list, the Perl repository, the Perlbug bug tracker, patch guidelines, and commentary on Perl development philosophy.
Note that you need to run make test_prep before the above commands work. (If you've run make test, you've effectively run make test_prep already.)
Run ./perl harness ../foo/boo.t in the t directory, with foo/boo the name of the failing test.
To run a single test script, use perl, or better, prove. Assuming you are in the module's base directory:
prove -lv t/some-test-script.t
This will run the test script against the libraries in ./lib, with fallback to the libraries available to your install of Perl.
If you want to use the build libraries built by make, then this:
prove -bv t/some-test-script.t
Now the test script will be run against the libraries in ./blib, falling back to libraries installed for your Perl.
The test scripts are typically just Perl scripts that live in a t/ or xt/ or some similar path within the distribution's directory structure. So you can also run them just with Perl:
perl -Iblib t/some-test-script.t
But prove produces nicer test summary information and color coding.
That is about as granular as you can get unless tests are written to allow for targeting specific segments within a test script. If you need to target a specific test within a test script you'll usually have to dig into the test code itself.

NUnit console - when attempting to redirect output /err seems to have no effect

I've got an Nunit project with some tests and they all run as expected. Now I want to incorporate the running of these scripts automatically.
I'm trying to use some of the redirect options so I can separate the test output, but whatever combination I use, all I seem to get is the standard TestResult.xml. I can use /out:AnnotherOut.txt OK, but I'm really interested in capturing the error output using /err:TestErrors.txt.
Command line is:
(NunitConsole App) /nologo /framework:net-4.0 MyTestProject.nunit /include=Integration /err=TestErrors.txt

Where the TeamCity service messages should be written?

I'm a beginner on TeamCity, so forgive my dump question.
For some reason the coverage reporting for my solution is not working. So, to run the tests I run nunit-console in a command line step and then use the xml output file in a build feature of type [XML report processing]. Test results appear on the TeamCity GUI but no coverage statistics.
It seems to be that there a way to configure the tests reporting manually https://confluence.jetbrains.com/display/TCD8/Manually+Configuring+Reporting+Coverage but I don't know where to put these service messages:
teamcity[dotNetCoverage ='' ='' ...]
Just write them to standard output. It is captured by TeamCity and service messages from it will be processed.
Pay attention, however, to the syntax. Service message should begin with ##
As Oleg already stated you can dump them in standard output
Console.WriteLine(...) from C#
echo from command prompt or powershell,
...
Here is an example http://log.ld.si/2014/10/20/build-log-in-teamcity-using-psake
There is a psake helper module, https://github.com/psake/psake-contrib/wiki/teamcity.psm1 and source is available on https://github.com/psake/psake-contrib/blob/master/teamcity.psm1 (you can freely use this from powershell as well)
It has already implemented alot of Service Messages

Not able to generate the code coverage result using Devel::Cover

I tried to find code coverage for a c4rgr.pl test file with Devel::Cover. I have a .pm module sitting in the same area. I am using perl -MDevel::Cover c4rgr.pl, which generates a cover_db and has a runs subdirectory inside.
Inside the runs subdirectory, a versionated directory is created every time I run the Cover command and a cover.13 is obtained. This cover.13 file (I think) has the raw data for code coverage results.
Still, I am unable to get the test results in a HTML output format or on the Terminal screen.
This is what I do:
Run the perl -MDevel::Cover c4rgr.pl
Here, the c4rgr.pl uses a .pm module which is sitting in the same area.
When I run above command, it runs the test file but no test coverage output as shown in Devel::Cover HTML output is obtained. Nevertheless, the cover.13 file is created every time.
Cover.13 <- 1401378982.24872.12631 <- runs <- cover_db .
Can someone tell me how to get the HTML file, please? I was able to run a dummy test with the same features and generate a HTML file. But with my actual test, it does not. Or is there a way to convert the cover.13 file to HTML that is not being done in my case?
After running perl -MDevel::Cover c4rgr.pl, run the cover command. For example:
cover -report html -outputdir cover_report

Perl command-line based script, running it on a website?

I have a Perl script that works perfectly when I run it from my command prompt. But when I upload it to the cgi-bin folder on my website, it doesn't work. Is there a special format it needs to be or something? I'm totally new to Perl.
Also note: the test hello page Perl script works.
When you run your perl script under cgi (which you indicated is working), the query is passed to your script as STDIN, and the output of your script is sent to the browser.
There will not be a prompt, or anything like that, you need something else (such as a web page) to prompt the user for anything you need and submit it to your script.
The next page on from Bill's link (http://www.lies.com/begperl/form_to_email.html) deals with this.