FitSharp FormatException when running tests - fitnesse

I installed a clean version of Fitnesse (v20121220) and the latest version of FitSharp (.net 4).
I've created a fitnesse test page but cannot get the tests to run - whenever I try, the tests immediately fail with the following stack trace in the standard output: -
System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at fit.Runner.FitSocket.EstablishConnection(String request)
at fitnesse.fitserver.FitServer.EstablishConnection()
at fitnesse.fitserver.FitServer.Run(IList`1 CommandLineArguments)
at fitnesse.fitserver.FitServer.Run(IList`1 commandLineArguments, Memory memory, ProgressReporter reporter)
at fitSharp.Machine.Application.Shell.Run()
at fitSharp.Machine.Application.Shell.Execute()
at fitSharp.Machine.Application.Shell.RunInCurrentDomain(IList`1 commandLineArguments)
at fitSharp.Machine.Application.Shell.RunInNewDomain(AppDomainSetup appDomainSetup, IList`1 commandLineArguments)
And the following error as Internal Exception: -
Internal Exception:
FitClient: external process terminated before a connection could be established.
My root configuration is pretty basic: -
!define COMMAND_PATTERN {%m -a "FullPathToAcceptanceTests.dll.config" -r fitnesse.fitserver.FitServer,C:\fitnesse\fitsharp\fit.dll %p}
!define TEST_RUNNER {c:\fitnesse\fitsharp\Runner.exe}
!path "FullPathToAcceptanceTests.dll"
Obviously the FullPathToAcceptanceTests points to where my fitnesse acceptance tests code is.
I don't understand why this is happening - I've used Fitnesse / Fitsharp before without problems, but this just doesn't seem to want to work.

I think that this problem might be caused by running Fitnesse on default 80 port.
FitLibrary and Fit are sometimes using the same port, which might cause an issue.
Try using different port.

I have
!path "FullPathToAcceptanceTests.dll"
!define COMMAND_PATTERN {%m -r "fitnesse.fitserver.FitServer,C:\fitnesse\fitsharp\fit.dll" %p}
!define TEST_RUNNER {c:\fitnesse\fitsharp\Runner.exe}

Related

SQLCMD failure executing stored procedure with parameter

New to using SQLCMD.
If I run the following sqlcmd I get an error
Incorrect syntax near '.209
Command:
sqlcmd -E -S MyServer\SQLEXPRESS -d MyDatebase-Q "EXEC spRunThisPS #IP=$(IP)" /v IP="192.168.209.4"
If I just have "192.168" as the parameter the script will run (obviously the PS fails because invalid ip). Not sure if the amount of "." causes it to fail or not.
Any thoughts or suggestions?
Nick
You probably need to wrap the parameter value in quotes, either by specifying the IP value as IP="'192.168.209.4'", or by adding them around the parameter value in the EXEC command (EXEC spRunThisPS #IP='$(IP)').
Otherwise it's trying to interpret it as a numeric value rather than a string, which is why 192.168 is ok and 192.168.209.4 isn't.

Fitnesse: Connection Reset

I am running tests in fitnesse with the following issue occurring:
Internal Exception:
Connection Reset
Does anyone know why this is occurring and how to fix it?
SuiteSetup contains file:
!define TEST_SYSTEM {fit}
!define COMMAND_PATTERN {%m -r fitnesse.fitserver.FitServer, C:\GrowthEdition.QA\fitnesse\fitSharp\fit.dll %p}
!define TEST_RUNNER {C:\GrowthEdition.QA\fitnesse\fitSharp\Runner.exe}
!define COLLAPSE_SETUP {true}
!define COLLAPSE_TEARDOWN {true}
!define MANUALLY_START_TEST_RUNNER_ON_DEBUG {debug}
!path C:\GrowthEdition.QA\fitnesse\fitSharp\*.dll
!path C:\Users\rdixit\Documents\Visual~3\Projects\LearningTestAutomation\LearningTestAutomation\bin\x86\Debug\LearningTestAutomation.dll
I assume that you started Fitnesse server ok. And you are working on a Fitnesse wiki page and your test fixture.
The connection reset happens when your test is trying to connect a web server but it's failed. You may need to debug your test to see what it is connecting.
I put a guideline link for reference.
https://vikashazrati.wordpress.com/2007/12/05/remote-debugging-fitnesse-with-eclipse/

Jenkins - Posting results to a external monitoring job is adding garbage to the build job log

I have a external monitor job that I'm pushing the result of another job to it with curl and base on this link :
Monitoring external jobs
After I create the job I just need to run a curl command with the body encoded in HEX to the specified url and then a build will be created and the output will be added to it but what I get instead is part of my output in clear text and the rest in weird characters like so :
Started
Asking akamai to purge this urls:
http://xxx/sites/all/modules/custom/uk.png http://aaaaaasites/all/modules/custom/flags/jp.png
<html><head><title>401 Unauthorized</title> </h�VC��&�G����CV�WF��&��VC�������R&R��BWF��&��VBF�66W72F�B&W6�W&6S�����&�G�����F����F�RW&�F �6�V6�7FGW2�bF�R&WVW7B�2��F�RF��RF�v�B�2��6�Ɩ�r&6�w&�V�B��"F�6�V6�7FGW2�bF�RF�6�W#�v�F��rf�"���F�W&vRF��6O request please keep in mind this is an estimated time
Waiting for another 60 seconds
Asking akamai to purge this urls:
...
..
..
This is how I'm doing it :
export output=`cat msg.out|xxd -c 256 -ps`
curl -k -X POST -d "<run><log encoding=\"hexBinary\">$output</log><result>0</result> <duration>2000</duration></run>" https://$jenkinsuser:$jenkinspass#127.0.0.1/jenkins/job/akamai_purge_results/postBuildResult -H'.crumb:c775f3aa15464563456346e'
If I cat that file is all fine and even if I edit it with vi I can't see any problem with it.
Do you guys have any idea how to fix this ?
Could it be a problem with the hex encoding ? ( I tried hex/enc/dec pages with the result of xxd and they look fine)
Thanks.
I had the same issue, and stumbled across this: http://blog.markfeeney.com/2010/01/hexbinary-encoding.html
From that page, you can get the encoding you need via this command:
echo "Hello world" | hexdump -v -e '1/1 "%02x"'
48656c6c6f20776f726c640a
An excerpt from the explanation:
So what the hell is that? -v means don't suppress any duplicate data
in the output, and -e is the format string. hexdump's very particular
about the formatting of the -e argument; so careful with the quotes.
The 1/1 means for every 1 byte encountered in the input, apply the
following formatting pattern 1 time. Despite this sounding like the
default behaviour in the man page, the 1/1 is not optional. /1 also
works, but the 1/1 is very very slightly more readable, IMO. The
"%02x" is just a standard-issue printf-style format code.
So in your case, you would do this (removing 'export' in favor of inline variable)
OUTPUT=`cat msg.out | hexdump -v -e '1/1 "%02x"'` curl -k -X POST -d "<run><log encoding=\"hexBinary\">$OUTPUT</log><result>0</result> <duration>2000</duration></run>" https://$jenkinsuser:$jenkinspass#127.0.0.1/jenkins/job/akamai_purge_results/postBuildResult -H'.crumb:c775f3aa15464563456346e'

Monitoring URLs with Nagios

I'm trying to monitor actual URLs, and not only hosts, with Nagios, as I operate a shared server with several websites, and I don't think its enough just to monitor the basic HTTP service (I'm including at the very bottom of this question a small explanation of what I'm envisioning).
(Side note: please note that I have Nagios installed and running inside a chroot on a CentOS system. I built nagios from source, and have used yum to install into this root all dependencies needed, etc...)
I first found check_url, but after installing it into /usr/lib/nagios/libexec, I kept getting a "return code of 255 is out of bounds" error. That's when I decided to start writing this question (but wait! There's another plugin I decided to try first!)
After reviewing This Question that had almost practically the same problem I'm having with check_url, I decided to open up a new question on the subject because
a) I'm not using NRPE with this check
b) I tried the suggestions made on the earlier question to which I linked, but none of them worked. For example...
./check_url some-domain.com | echo $0
returns "0" (which indicates the check was successful)
I then followed the debugging instructions on Nagios Support to create a temp file called debug_check_url, and put the following in it (to then be called by my command definition):
#!/bin/sh
echo `date` >> /tmp/debug_check_url_plugin
echo $* /tmp/debug_check_url_plugin
/usr/local/nagios/libexec/check_url $*
Assuming I'm not in "debugging mode", my command definition for running check_url is as follows (inside command.cfg):
'check_url' command definition
define command{
command_name check_url
command_line $USER1$/check_url $url$
}
(Incidentally, you can also view what I was using in my service config file at the very bottom of this question)
Before publishing this question, however, I decided to give 1 more shot at figuring out a solution. I found the check_url_status plugin, and decided to give that one a shot. To do that, here's what I did:
mkdir /usr/lib/nagios/libexec/check_url_status/
downloaded both check_url_status and utils.pm
Per the user comment / review on the check_url_status plugin page, I changed "lib" to the proper directory of /usr/lib/nagios/libexec/.
Run the following:
./check_user_status -U some-domain.com.
When I run the above command, I kept getting the following error:
bash-4.1# ./check_url_status -U mydomain.com
Can't locate utils.pm in #INC (#INC contains: /usr/lib/nagios/libexec/ /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5) at ./check_url_status line 34.
BEGIN failed--compilation aborted at ./check_url_status line 34.
So at this point, I give up, and have a couple of questions:
Which of these two plugins would you recommend? check_url or check_url_status?
(After reading the description of check_url_status, I feel that this one might be the better choice. Your thoughts?)
Now, how would I fix my problem with whichever plugin you recommended?
At the beginning of this question, I mentioned I would include a small explanation of what I'm envisioning. I have a file called services.cfg which is where I have all of my service definitions located (imagine that!).
The following is a snippet of my service definition file, which I wrote to use check_url (because at that time, I thought everything worked). I'll build a service for each URL I want to monitor:
###
# Monitoring Individual URLs...
#
###
define service{
host_name {my-shared-web-server}
service_description URL: somedomain.com
check_command check_url!somedomain.com
max_check_attempts 5
check_interval 3
retry_interval 1
check_period 24x7
notification_interval 30
notification_period workhours
}
I was making things WAY too complicated.
The built-in / installed by default plugin, check_http, can accomplish what I wanted and more. Here's how I have accomplished this:
My Service Definition:
define service{
host_name myers
service_description URL: my-url.com
check_command check_http_url!http://my-url.com
max_check_attempts 5
check_interval 3
retry_interval 1
check_period 24x7
notification_interval 30
notification_period workhours
}
My Command Definition:
define command{
command_name check_http_url
command_line $USER1$/check_http -I $HOSTADDRESS$ -u $ARG1$
}
The better way to monitor urls is by using webinject which can be used with nagios.
The below problem is due to the reason that you dont have the perl package utils try installing it.
bash-4.1# ./check_url_status -U mydomain.com Can't locate utils.pm in #INC (#INC contains:
You can make an script plugin. It is easy, you only have to check the URL with something like:
`curl -Is $URL -k| grep HTTP | cut -d ' ' -f2`
$URL is what you pass to the script command by param.
Then check the result: If you have an code greater than 399 you have a problem, else... everything is OK! THen an right exit mode and the message for Nagios.

Fitnesse trying to load "defaultPath" as assembly

I am trying to specify a custom converter to Slim by specifying a suite configuration.
When I manually append ?test (the button doesn't appear for some reason), I get the following exception:
__EXCEPTION__:System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Path\To\fitnesse\__defaultPath__'
Any idea why it would be trying to load "defaultPath" as an assembly from the current working directory?
Below is my suite configuration:
<?xml version="1.0" encoding="utf-8" ?>
<suiteConfig>
<ApplicationUnderTest>
<AddAssembly>C:\Path\To\TestsAssembly.dll</AddAssembly>
<AddNamespace>Tests_Namespace</AddNamespace>
<AddAssembly>C:\Path\To\fitSharp.dll</AddAssembly>
</ApplicationUnderTest>
<fitSharp.Machine.Application.Settings>
<Runner>fitSharp.Slim.Service.Runner</Runner>
</fitSharp.Machine.Application.Settings>
<fitSharp.Slim.Service.Service>
<AddOperator>NamespaceToConverter.NullableDecimalConverter</AddOperator>
</fitSharp.Slim.Service.Service>
</suiteConfig>
My Fitnesse wiki page starts like this:
!define TEST_SYSTEM {slim}
!define COMMAND_PATTERN {"%m" -c c:\Path\To\SlimConfig.xml %p}
!define TEST_RUNNER {C:\Path\To\fitsharp\Runner.exe}
|import|
... etc
If you don't have a !path, it defaults to 'defaultPath', so that's what was being passed as the %p parameter. As you discovered, you should remove the %p if you don't have a !path.
I was able to work around the problem by removing the classpath parameter (%p) from COMMAND_PATTERN:
!define COMMAND_PATTERN {%m -c c:\Path\To\SlimConfig.xml}

Resources