Running Fitnesse Tests from Command Line - fitnesse

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"

Related

How to find output of shell command run by fastlane action?

Sometimes it happens that a fastlane action throws an error like:
ERROR [2016-11-06 03:34:20.16]: Shell command exited with exit status 48 instead of 0.
I found troubleshooting difficult, as --verbose is not not verbose enough. By action I don't mean sh action, which is rather special case, but other fastlane actions e.g. create_keychain. The action create_keychain calls shell command security create-keychain and when it fails there is no clue what happened.
How do I find output of a shell command run by fastlane's action?
How do I find what shell command including all parameters is fastlane actually trying to run?
The output of the shell command is printed out by default when you use the sh action. Alternatively you can also run the shell command directly yourself using backticks (standard Ruby)
puts `ls`
The answer is that there is no such option at the moment, but it should be easy to add it.
I have created git issue #6878 for it.

fitnesse hangs in fitnesse.testrunner.MultipleTestsRunner.waitForTestSystemToSendResults

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

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.

Running multiple commands in cmd via psexec

I'm working on creating a single command that will run mulitple things on the command line of another machine. Here is what I'm looking to do.
Use psexec to access remote machine
travel to proper directory and file
execute ant task
exit cmd
run together in one line
I can run the below command from Run to complete what I need accomplished but can't seem to get the format correct for psexec to understand it.
cmd /K cd /d D:\directory & ant & exit
I've tried appling this to the psexec example below:
psexec \\machine cmd /K cd /d D:\directory & ant & exit
When executing this it will activate the command line and travel to D:\directory but won't execute the remaining commands. Adding "" just creates more issues.
Can anyone guide me to the correct format? Or something other than psexec I can use to complete this (free options only)?
Figured it out finally after some more internet searching and trial and error. psexec needs /c to run multiple commands, but that syntax doesn't work with the setup I wrote above. I've gotten the below command to run what I need.
psexec \\machine cmd /c (^d:^ ^& cd directory^ ^& ant^)
I don't need to exit because psexec will exit itself upon completion. You can also use && to require success to continue on to the next command. Found this forum helpful
http://forum.sysinternals.com/psexec_topic318.html
And this for running psexec commands
http://ss64.com/nt/psexec.html
This works:
psexec \ComputerName cmd /c "echo hey1 & echo hey2"
For simple cases I use:
PsExec \\machine <options> CMD /C "command_1 & command_2 & ... & command_N"
For more complex cases, using a batch file with PsExec's -c switch may be more suitable:
The -c switch directs PsExec to copy the specified executable to the remote system for execution and delete the executable from the remote system when the program has finished running.
PsExec \\machine <options> -c PSEXEC_COMMANDS.cmd <arguments>
Since you asked about other options and this has tag configuration managment-- I guess you may be interested in Jenkins (or Hudson). It provide very good way of creating master-slave mechanism which may help in simplifying the build process.
I always use like this way :) and works properly
psexec \\COMPUTER -e cmd /c (COMMAND1 ^& COMMAND2 ^& COMMAND3)

Fitnesse: No ErrorLogs generated in command line/linux environment

Running Fitnesse in Linux using a command line such as:
java -jar fitnesse.jar -c "TestName?test&format=text"
However, the system.out, which shows up in ErrorLogs in a PC environment does not get created.
Is there a switch to turn this on?
Thanks,
John
Here is documentation for the command line options:
http://fitnesse.org/FitNesse.UserGuide.QuickReferenceGuide#FitNesseCommandLINE
It looks like there's a -l option to specify where the logs should be created.
Try specifying -l /tmp/log.out just to make sure there are no permissions issues.

Resources