Running Fitnesse in Debug mode [closed] - fitnesse

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I used to use Fitnesse daily years ago, but forgot how to run tests in debug mode (or have stack trace information be output) - does anyone know?
I recall being able to configure it either as a flag when running/starting up fitnesse.jar, or as a URL parameter (e.g. http://localhost:8090/FitLibraryWeb.MyTest?test&debug=true)

To debug fixtures in .Net I normally add Debugger.Break() inside my C# fixture code

Although my prefered development solution has already been pointed out on Rustin's DebugBreak() suggestion, and alternate solution is to invoke RunnerW.exe, which requires adding the following line to your target Fitnesse test page
[[Press me to start in remote debug mode][?responder=test&remote_debug=true]]
Please, bear in mind that I am assuming your test page already defines REMOTE_DEBUG_RUNNER pointing to RunnerW.exe, as stated in Fitnesse guide's Customizing Test Execution section
For the sake of simplicity, I will present a sample fit test header.
So, here is how to Remote Debug using Visual Studio:
Make sure you fitnesse test page starts with the following lines
!define TEST_RUNNER {FitSharp\Runner.exe}
!define REMOTE_DEBUG_RUNNER {FitSharp\RunnerW.exe}
[[Press me to start in remote debug mode][?responder=test&remote_debug=true]]
The rest of your test specification goes here
In Visual Studio, set target code breakpoint
On fit test page, click on Press me to start in remote debug mode, defined above. This starts the RunnerW.exe process (winform app called Fitsharp) which will wait for 30 seconds (I am not sure).
In Visual Studio > Debug menu > Attach to process, locate RunnerW.exe and press Attach button.
On Fitsharp window (RunnerW.exe process), click GO button and you are on your way.
As pratical solution, I use the following strategy:
I create static page called SetupEngine and add the 3 lines stated on previous step 1.
On the top of every test page, I just put the following header, so I don't have to repeat those 3 lines.
!include .SetupEngine
Note that . (dot) on .SetupEngine (which is a path) refers to your Fitnesse root page. You may have to adjust it.
I had this ideia when I was referring to Fitnesse.UserGuide's remote debug section
Hope it helps

Add the following line just before the your test target location
!|debug|
For further details, refer to Michael Sorens' excelent article, the most comprehensive article on Fitnesse debug techniques.

Your thinking of using RunnerW.exe as opposed to the Runner.exe.
If you change your test runner to be RunnerW a pop-up window will appear with a 'go' button on it, and will not start the fitnesse test until you hit it.
Before hitting go you can attach to any process (via 'Attach To Process' in the debug menu if your using VS) and the execution will pause at the break points set.
Note: You must have the same build being used by FitNesse as the code you are debugging.
You can also attach to a remote process, using the Remote Debugger.
Also, if you attach the the RunnerW.exe process, you can debug the fixtures themselves.

I haven't had to do it in a while, but the current documentation that comes with FitNesse indicates that you are close. You should be using remote_debug instead of debug.
The best thing is to start with the documentation that comes with your copy of FitNesse, as it matches what you are running. If you are running on port 8080, then the following link should work: http://localhost:8080/FitNesse.UserGuide.DebugingFixtureCode.
Assuming you are using Java, these instructions should help. If you are using a different language I am not sure I can help.

Related

Fitnesse: is it possible to disable Test and Suite buttons?

I am running Fitnesse on several dispathers and then copy Fitnesse history and logs from all dispatchers to a separate machine. Some other project members need access to test results on this machine but I don't want them to be able to click Test or Suite there. Is it somehow possible to disable Test and Suite buttons?
I would be glad for any options: either somehow configure it in Fitnesse, or get a patched fitnesse.jar, or any other options.
On the main Fitnesse site (http://fitnesse.org/StayInformed), there is the following note: "Note, the Test and Suite buttons on this site have been disabled because search engines tend to invoke them and put my server under stress. This site is actually created with FitNesse.". So I need something like that, if possible.
Is it possible? Not sure I can find a corresponding place in source code to patch and re-build it. My hope is whether someone already did it or find it easy to help. I raised an issue in GitHub where Fitnesse source code is located but I didn't get any feedback yet.
Thank you!
It is indeed possible, that is indeed what is done for fitnesse.org.
I'm not 100% sure how its done but I suspect it is done by disabling 'responders', see http://fitnesse.org/FitNesse.UserGuide.AdministeringFitNesse.ConfigurationFile.
In that page a description is given to disable creating new pages:
Responders=addChild:fitnesse.responders.DisabledResponder,new:org.fitnesse.responders.DisabledResponder
You can probably also use this to disable SuiteResponder and TestResponder, by using:
Responders=suite:fitnesse.responders.DisabledResponder,test:org.fitnesse.responders.DisabledResponder
The full list of responders is in fitnesse.responders.ResponderFactory
On a side note: why do need a full FitNesse installation to show test results? I recommend you look into generating tests results in html format, and just publish that html somewhere. I usually use the jUnit runner to run the tests on a build server (it also creates html output) and then publish the html files generated as build artefact which people can open/view.
Sample, from FitNesse project, generating html in build/fitnesse-results:
import org.junit.runner.RunWith;
#RunWith(FitNesseRunner.class)
#FitNesseRunner.Suite("FitNesse.SuiteAcceptanceTests.SuiteSlimTests.TestScriptTable")
#FitNesseRunner.FitnesseDir(".")
#FitNesseRunner.OutputDir("./build/fitnesse-results")
public class FitNesseRunnerTest {
}

Intellij is not running individual Spock tests in Grails any more

My company switched from idea-131 to idea-171 a few months back (which I've been keeping updated ever since). One thing I've noticed is that I can no longer run Spock unit tests individually anymore. Instead, when I right click on a test, it only offers me the ability to run the whole file. That's kind of annoying if a page has 40 tests! Is there a config somewhere that I need to tick?
Nevermind, I answered that question as soon as i asked it! they've moved the option to a little play button headed beside each test method. I'm not a fan of iconicizing little commands but ... there you go.

Fitnesse - runner process not starting

I have a test in fitnesse which used to work, but when I got into work today the test did not start at all. As soon as I press test I get the "0 errors 0 warrings..." text on the top of the test. Looking in the source control software, I can not find any changes to the test, or to anything related to it. I have noticed that the runner process does not start when I run the test. Other tests seem to work fine, and I can copy the tables from the test which is not working into an other test and everything is fine. Any ideas on what could be wrong?
My standard answer in this situation is, "have you checked your classpath?"
I say this, as typically when this sort of thing happens, it is that the !path doesn't point to the stuff you need, whether it be FitNesse.jar or your own custom code.
Also, do you get an output page where you can check the classpath? i doubt it, but that can help diagnose classpath issues.

How do I add the Debug link on the side of a Fitnesse fixture page?

I'm trying to make debugging our Fitnesse tests easier. We're using runnerw.exe for debugging, it works fine. The UserGuide implies there can be a Debug action with the Test, Edit, etc links on the side of the fixture page.
However, there's no Debug action on our fixture pages. Can anyone tell me how to add it?
Well, changing the buttons on the left hand side involves actually modifying code in FitNesse. So that is a bit bigger of a deal to do.
However, I can give you a couple of options.
First, you could give everyone a bookmarket that they can use that will run the current page (and set the debug flag). The following does it :
javascript:cur_loc=location.href;location.href=cur_loc + "?test&remote_debug=true";
Second, is that you might be able to add the same thing to the PageHeader or PageFooter page, so that it appears everywhere. But then there will be the issue of the option being there even though you are not on a test page.
!-Run Page in Debug Mode-!

How do I do an http request upon successful Inno Setup install, for tracking purposes?

When my program successfully installs via Inno Setup, how do I run a URL in the background? I want to just load a tracking pixel (or a postback) which says that my program was installed.
I'm aware than in the [Run] section, I can run a .url file with the flag "runhidden", but as far as I know that won't do what I need it to. Am I wrong about that, or are there better option?
Thank you.
There is no TCP/IP related Support Functions, defined by default.
You could build this functionality into a DLL and call it from you Install Script.
This is done installation's where Activation is required to make the program work.
However, I would just launch a browser window using the [Run] section that contains "Getting Started" information. You can then track hits to that page.

Resources