fitnesse hangs in fitnesse.testrunner.MultipleTestsRunner.waitForTestSystemToSendResults - fitnesse

In approximately 1 of 10 of our fitnesse test runs running headless (from cmd line, not in browser) the run hangs in fitnesse.testrunner.MultipleTestsRunner.waitForTestSystemToSendResults
We ensured with using listeners and console output that all tests that were announced to run are completed. We used the following methods to ensure that:
fitnesse.testrunner.TestsRunnerListener.announceNumberTestsToRun(int) and fitnesse.testsystems.TestSystemListener.testComplete(PageType, TestSummary)
So our tests always hang after the last test of the suite was executed. The wait is done until a volatile member int testsInProgressCount is decreased to 0 but this does not seem to happen.
Does anybody have similar issues with fitnesse or any idea what is the reason or a good idea how to troubleshoot the issue?
Some more information:
Fitnesse version: 20150814
Platform: Linux centos 6.5 (kernel is 2.6.32-431.el6.x86_64)
Cmdline (simplified): java -cp <CLASSPATH> -r fitnesse -c <TestSuiteName>?suite&format=xml&includehtmlFalse -b OutFile -p <PORT> fitnesseMain.FitNesseMain
using 1.8

Related

`dotnet test` capturing garbage characters which mess up the output - need to remove

I am similar issue to expect script capturing garbage characters - need to remove. Logs and console output contain these ANSI escape sequences and messing up with the resulting output. It became difficult to understand what is going on in actual process. We are using Centos:7 and we are running dotnet test in a docker container. We are building and testing dotnet application. All the logs are visible and perfect but during dotnet test command we receive multiple garbage characters and it also messing up the result as well.
It looks like these characters also contain something which makes logs to start from the start of terminal without clearing the old logs and that also messes up the logs.
output
Run test [sample_test]
Test Run Successful.ding projects
Total tests: 1
Passed: 1
Total time: 1.9039 Seconds
Installing trx2junit
You can invoke the tool using the following command: trx2junit
Tool 'trx2junit' (version '1.2.6') was successfully installed.
trx2junit (c) gfoidl -- v1.2.6sion 16.3.0+0f4c62fea for .NET Core
https://github.com/gfoidl/trx2junit. All rights reserved.
....
...
./build/xunit-results/sss.Test.trx
./build/xunit-results/junit-results/sss.Test.xml
~/testError(s)
Test done!ed 00:00:05.11
zzz:~/git/testproject$ ;1R;9R;1R;9R;1R;9R
........
Microsoft (R) Test Execution Command Line Tool Version 16.3.0
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Results File: /tmp/tmp.Lr3H7XaRyB/build/xunit-results/sss.Test.trx
^[[40;1R^[[40;9R
This issue is faced while running the dotnet test in the docker container with --tty or -t option. If we run the same dotnet test in the docker container with -it option it works perfectly fine without any unwanted characters.
I think some issue with the combination of dotnet test in docker container with --tty option.
Any help and suggestion would be appreciated.
The solution I found for this problem was to pipe the output through tr to strip control characters:
# Strip control characters from output except `\t\n\r`.
dotnet test | tr -d '\000-\010\013\014\016-\037'
Copied from this SO comment: Removing Control Characters from a File. That thread has a number of other solutions to the same problem.

why does dockerized zap hang at the end of a baseline scan?

Fresh image and container of
owasp/zap2docker-stable:latest
The command:
docker exec zap1 ./zap-baseline.py
Hangs or processes forever afer:
FAIL-NEW: 0 FAIL-INPROG: 0 WARN-NEW: 4 WARN-INPROG: 0 INFO: 0 IGNORE: 0 PASS: 12
While earlier (2-3 months ago) it executed properly. Btw when I execute the same command inside the container, then it executes and shuts down properly. How to fix this so that jenkins job won't be stuck forever at the summary?
BTW Why does baseline-scan.py always print out the help section if I add '-r report.html' at the end? (EDIT, a typo -t instead of -r, but the problem stays)
That command doesnt look right to me.
The recommended command is:
docker run -t owasp/zap2docker-stable zap-baseline.py -t https://www.example.com
As per https://github.com/zaproxy/zaproxy/wiki/ZAP-Baseline-Scan
Its always printing out the help because '-t report-html' isnt valid. Look at the help shown to see the valid arguments. For an html report you should be using '-r report.html'

Fitnesse - Remote debug error

I'm trying to enable remote-debugging with fitnesse. Getting below error.
Could not complete testing: java.lang.Exception: FitClient: external
process terminated before a connection could be established.
To start fitnesse in debug-mode, i'm adding below startup command
set DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9000
java -jar %DEBUG_OPTS% fitnesse-standalone.jar -p 81
And with this, able to connect to the Fitness process, but enabling Tools->Remote Debug from Fitnesse GUI gives above error. Any pointers?
FitNesse is starting the System under test in a separate process by default. You can execute the test suite with debugging enabled, e.g. "MySuite?suite&debug".
Make sure all required libraries are on your class path (the one you use to start FitNesse "java -cp jar1.jar:classes:fitnesse-standalone.jar fitnesseMain.FitNesseMain -p 81"), since your application will be started inside the FitNesse process.

Unable to run functional tests on server. [geb spock]

Hi I am running my functional tests using geb.
I am able to run tests on my local computer correctly. but as I deploy my application to server. the build for functional tests fails.
Here is my console output
|Running 10 spock tests... 1 of 10
Failure: |
sign in with voucher
|
geb.driver.DriverCreationException: failed to create driver from callback 'script14007213321291157436758$_run_closure1#77068fce'
at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:35)
at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy:80)
at geb.driver.CachingDriverFactory$SimpleCache.get(CachingDriverFactory.groovy:30)
at geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.groovy:79)
at geb.Configuration.createDriver(Configuration.groovy:346)
at geb.Configuration.getDriver(Configuration.groovy:335)
at geb.Browser.getDriver(Browser.groovy:105)
at geb.Browser.go(Browser.groovy:377)
at geb.Page.to(Page.groovy:171)
at geb.Browser.via(Browser.groovy:454)
at geb.Browser.to(Browser.groovy:413)
at geb.Browser.to(Browser.groovy:391)
at geb.spock.GebSpec.methodMissing(GebSpec.groovy:51)
at VoucherSpec.sign in with voucher(VoucherSpec.groovy:14)
Caused by: org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/usr/local/bin/firefox) on port 7056; process output follows:
Error: no display specified
Error: no display specified
Can anyone guide me to solve this issue.
The server you're running the tests on is 'headless' so doesn't have a display to start Firefox on to run the tests. You've got a couple of options:
Switch from Firefox to a headless browser such as HTMLUnit.
Configure a virtual display on the server.
Use a remote browser service such as SauceLabs.
If you need to test directly on Firefox then HTMLUnit isn't an option for you.
Using a remote browser service such as SauceLabs or BrowserStack has a couple of advantages, for example they record a video of the session and take screenshots, but we found the overhead of passing commands & traffic over the network made the tests unacceptably slow. If you need to test a wide variety of browsers then the overhead diminishes because you can run in parallel...
Option 2, using a virtual display, is the simplest to configure on most servers. If you're using Linux the X Virtual Frame Buffer (XVFB) will get you up and running quickly. It's worth reading up on what's going on but the short answer is:
Install XVFB (sudo apt-get install xvfb)
Install Firefox (sudo apt-get install firefox)
Start XVFB (sudo Xvfb :10 -ac -screen 0 1024x768x8 &). You may want to add an init script so this happens every time the server starts
In your CI server add export DISPLAY=:10 as a step before the tests are run
Run your tests
The XVFB creates a virtual display on :10, which you then set as the default display. When you start Firefox it's completely unaware that it's on a virtual display, so things like getting Geb to take screenshots of failing tests will work as normal.
For more information about the steps see:
http://www.installationpage.com/selenium/how-to-run-selenium-headless-firefox-in-ubuntu/
https://github.com/tomaslin/grails-test-recipes
http://www.semicomplete.com/blog/geekery/xvfb-firefox.html
http://www.labelmedia.co.uk/blog/setting-up-selenium-server-on-a-headless-jenkins-ci-build-machine.html
http://manpages.ubuntu.com/manpages/lucid/man1/xvfb-run.1.html
If you need an init script to get it to start/stop, then there are quite a few to choose from, such as this one.

Running Fitnesse Tests from Command Line

When running the Fitnesse tests via command Line I am getting a ClassNotFound Exception
caused by Java.lang.ClassNotFoundException:fitnesse.runner.testRunner
could not find the main class:fitnesse.runner.TestRunner.Program will exit
Kindly help
Thanks
TestRunner is no longer supported. Use http://fitnesse.org/FitNesse.UserGuide.CommandLineRestCommands
Update: link has changed - http://www.fitnesse.org/FitNesse.UserGuide.ControllingFitNesseFromTheCommandLine
Update: link has changed again - http://fitnesse.org/FitNesse.UserGuide.AdministeringFitNesse.ControllingFitNesseFromTheCommandLine
Excerpt from Fitnesse docs:
You can run any REST command (See Restful Services) from the command
line by using the -c command line option as follows:
java -jar fitnesse-standalone.jar -c
This starts up fitnesse, runs the command, emits the output to
standard out, and then exits.
Most often you will use this to run tests and/or suites from the
command line as follows:
java -jar fitnesse-standalone.jar -c "MyTestPage?test&format=text"

Resources