Dbfit cannot find fixtures - fitnesse

I wrote the folowing test but am getting error:
Could not find fixture: Connect.
!path lib/*.jar
!|Import|
!|dbfit.SqlServerTest|
!|Import|
|dbfit.fixture|
!|Connect|Data Source=ACER\SQLEXPRESS;Initial Catalog=NopCommerce;Integrated Security=SSPI;|
!|query|select * from dbo.Employees|
!|Query| select 'test' as x| |x| |test|

Include the following at the top of your page:
!define TEST_SYSTEM {fit}

According to this answer, the syntax for the import should be:
!|import fixture|
|dbfit.fixture|
Note: the dbfit.fixture is in a separated row, and has no preceding exclamation mark, the sign of a command, so the mentioned error message should be read as: "Oh, I have found import command asking for something like dbfit.fixture, but the next line asks for a Connect fixture, which is not expected, because Connect is another command".

Try the following:
|import fixture|
|dbfit.fixture|
!|DatabaseEnvironment|sqlserver|
|Connect|192.168.0.3|user|pass|nz_db|
|Store query|!-select * from sql_tbl-!|fromtbl|
!|Query|<<fromsql|
|Rollback|
!|dbfit.util.ExportFixture|
|dbfit.fixture|
This works for me in DBFit Java.

Anything (even comments) between the 'DatabaseEnvironment' and the 'Connect' will also cause the 'Could not find fixture: Connect' error.
So, this fails:
|DatabaseEnvironment|sybase|
|Connect | jdbc:jtds:sybase://10.158.0.189:8000;user=myuser;password=mypass;databaseName=mydb |
But this works:
|DatabaseEnvironment|sybase |
|Connect |jdbc:jtds:sybase://10.158.0.141:8000;user=myuser;password=mypass;databaseName=mydb|

Related

Not able to execute any test case in rspec

I am really confused about this Psych BadAlias error.
I have tried everything but not able to debug this error.
When i am executing my test case i am getting this error
Failure/Error: #st.fetch(o.anchor) { raise BadAlias, "Unknown alias: #{o.anchor}" }
Psych::BadAlias:
Unknown alias: 2
But before it was working perfectly fine.
This is my fixtures file
workers.yml
Worker_1:
name: Hello
preferred_first_name: First
preferred_last_name: Last
assignment: Assignemnt_1
talent: Ruby_development
Any kind of Help is appreciated!
Thanks
A Psych::BadAlias exception will be raised if the yaml contains aliases but the aliases keyword argument is set to false.
Please check your yaml files. The error got raised from here. For more details please refer here
I solved it, as there was just a syntax error in yaaml file.
we canot use "p-r-a-t-i-k" we have to use "p_r_a_t_i_k"

ChicagoBoss rejects user as a model name

So following this tutorial:
https://github.com/evanmiller/ChicagoBoss/wiki/An-Evening-With-Chicago-Boss
Everything works like a charm except that I can not use "user" as a modelname. A minimum usecase:
-module(customer, [Id, Name, PasswordHash]).
-compile(export_all).
This will work fine.
-module(user, [Id, Name, PasswordHash]).
-compile(export_all).
this will stacktrace, and on ./rebar compile, it throws:
ERROR: pre_compile failed while processing /Users/abe/github/awesome-name: {'EXIT',{{badmatch,{error,["code reload failed: user"]}},
[{boss_load,load_all_modules,3,
[{file,"src/boss/boss_load.erl"},{line,30}]},
{boss_load,load_all_modules_and_emit_app_file,2,
[{file,"src/boss/boss_load.erl"},{line,44}]},
{boss_rebar,compile,4,
[{file,"/Users/abe/github/ChicagoBoss/priv/rebar/boss_rebar.erl"},
{line,85}]},
{boss_plugin,pre_compile,2,
[{file,"priv/rebar/boss_plugin.erl"},{line,105}]},
{rebar_core,run_modules,4,[]},
{rebar_core,execute,5,[]},
{rebar_core,process_dir1,6,[]},
{rebar_core,process_commands,2,[]}]}}
this occurs with both {db_adapter, mock} and {db_adapter, mongo}.
Anybody know what's going on? Is the user keyword reserved somewhere? I can't find it in the documentation if it is...
Erlang has a flat module namespace. There is a module named user in the kernel application.

Capybara issue when trying to click form submit button

I'm pretty new to Ruby/Rails and especially to Capybara and the whole process, so please bear with me as I've spent a lot of time on this already and I finally decided to ask because I'm sure it's something simple that I just am as-of-yet unaware of.
So I have a form that has several checkboxes that are designed to filter the results displayed (ie, you select one or more and submit and thew page reloads with the list filtered). In my features file, I have the following scenarios (the button to submit the form has a value="Refresh"):
Scenario: no ratings selected
When I uncheck the following ratings: G, PG, PG-13, NC-17, R
And I press "Refresh"
Then show me the page
And I should see none of the movies
Scenario: all ratings selected
When I check the following ratings: G, PG, PG-13, NC-17, R
And I press "Refresh"
Then show me the page
And I should see all of the movies
When I run this with rake features, it gives the following output:
And I press "Refresh" # features/step_definitions/web_steps.rb:61
xprop: unable to open display ''
I am using page.body a little later in the scenario and I believe this is the reason I then get the following errors:
Deprecated: please use #source_tags instead.
Warning: program returned non-zero exit code #1
WARNING: You don't seem to have any mimeinfo.cache files.
Try running the update-desktop-database command. If you
don't have this command you should install the
desktop-file-utils package. This package is available from
<link>
No applications found for mimetype: text/html
/usr/bin/xdg-open: 563: links2: not found
/usr/bin/xdg-open: 563: links: not found
/usr/bin/xdg-open: 563: lynx: not found
Error occured while reset 800b: errno=5
xdg-open: no method available for opening '/home/ubuntu/hw3_rottenpotatoes/tmp/capybara /capybara-201203260037535403047955.html'
Error occured: errno=5
Warning: program returned non-zero exit code #1
WARNING: You don't seem to have any mimeinfo.cache files.
Try running the update-desktop-database command. If you
don't have this command you should install the
desktop-file-utils package. This package is available from
<link>
No applications found for mimetype: text/html
/usr/bin/xdg-open: 563: links2: not found
/usr/bin/xdg-open: 563: links: not found
/usr/bin/xdg-open: 563: lynx: not found
Error occured while reset 800b: errno=5
xdg-open: no method available for opening '/home/ubuntu/hw3_rottenpotatoes/tmp/capybara /capybara-201203260037534847572739.html'
Error occured: errno=5
Warning: program returned non-zero exit code #1
WARNING: You don't seem to have any mimeinfo.cache files.
Try running the update-desktop-database command. If you
don't have this command you should install the
desktop-file-utils package. This package is available from
<link>
No applications found for mimetype: text/html
/usr/bin/xdg-open: 563: links2: not found
/usr/bin/xdg-open: 563: links: not found
/usr/bin/xdg-open: 563: lynx: not found
Error occured while reset 800b: errno=5
xdg-open: no method available for opening '/home/ubuntu/hw3_rottenpotatoes/tmp/capybara /capybara-20120326003754980186501.html'
Here are the relevant step definitions
When /I (un)?check the following ratings: (.*)/ do |unc, rating_list|
rating_list.split(", ").each do |r|
if(unc)
uncheck("ratings_#{r}")
else
check("ratings_#{r}")
end
end
assert true, "Implemented checking function"
end
Then /I should (not )?see movies with the following ratings: (.*)/ do |nt, rating_list|
flag = true
rating_list.split(", ").each do |r|
if(nt)
if(page.body =~ /<td>#{r}/)
flag = false;
end
else
if(page.body !~ /<td>#{r}/)
flag = false
end
end
end
assert flag, "Seeing (or not) movies of ratings list - implemented"
end
Then /I should see all of the movies/ do
tot = Movie.all.count
assert page.have_selector('tbody tr', :count => tot)
end
Then /I should see none of the movies/ do
num = page.body.scan(/00:00:00 UTC/m).length
assert size == 0, "Showing no movies - implemented"
end
When /^(?:|I )press "([^"]*)"$/ do |button|
click_button(button)
end
Then /^show me the page$/ do
save_and_open_page
end
I have been researching for days when I have time and there is just so much I don't know. Any help or insights would be greatly appreciated. Thank you!
Your problem is that you don't have any browser installed to handle html files.
It seems you are using an headless server (without X) so your system is trying to find a suitable browser (one that can be run from the command line).
Take a look at Capybara drivers and choose an appropriate one.

Double closure fails in GSP

In a GSP file I write something like this:
${tgs.singleGameSheets.find{it.matchnumber==1}.awayPlayer.fullname()}
But I receive the following error:
org.codehaus.groovy.control.MultipleCompilationErrorsException:
startup failed:
C__STS_Projekte_TischtennisManager_grails_app_views_league__showGameSheet_gsp:
49:expecting '}', found ')' # line 49, column 134.
heets.find{it.matchnumber==1 })
The problem seems to be the double closure as I've found a bug report here.
Unfortunately the solution from the bugreport with the %= and % at the beginning and the end of the tag is not working for me.
Are there any other workarounds or solutions for this double closure problem?
I'm using Grails 1.3.7.
You may have to split this up in to two lines.
Try assigning the find results to a separate var first
<% def r = tgs.singleGameSheets.find{it.matchnumber==1} %>
${r*.awayPlayer.fullname()}
I would recommend firstly to do this sort of data processing in the controller and hand data that is as well prepared as possible down to the view.
If you are unable to do that, I would recommend trying to use parenthesis:
${tgs.singleGameSheets.find{it.matchnumber==1}.awayPlayer.fullname()}
becomes
${(tgs.singleGameSheets.find{it.matchnumber==1}.awayPlayer.fullname())}
That has worked for me on past occasions where I had to do ${(someCollection.findAll { someClause })}

Vim: How do I tell where a function is defined? (

I just installed macvim yesterday and I installed vim latex today.
One of the menu items is calling a broken function (TeX-Suite -> view).
When I click on the menu-time it makes this call:
:silent! call Tex_ViewLatex()
Question: Where can I find that function? Is there some way to figure out where it is defined?
Just for curiosity sake I removed the silent part and ran this:
:call Tex_ViewLatex()
Which produces:
Error detected while processing function Tex_ViewLaTeX:
line 34:
E121: Undefined variable: s:viewer
E116: Invalid arguments for function strlen(s:viewer)
E15: Invalid expression: strlen(s:viewer)
line 39:
E121: Undefined variable: appOpt
E15: Invalid expression: 'open '.appOpt.s:viewer.' $*.'.s:target
line 79:
E121: Undefined variable: execString
E116: Invalid arguments for function substitute(execString, '\V$*', mainfname, 'g'
)
E15: Invalid expression: substitute(execString, '\V$*', mainfname, 'g')
line 80:
E121: Undefined variable: execString
E116: Invalid arguments for function Tex_Debug
line 82:
E121: Undefined variable: execString
E15: Invalid expression: 'silent! !'.execString
Press ENTER or type command to continue
I suspect that if I could see the source function I could figure out what inputs are bad or what it is looking for.
Use the :verbose prefix command:
:verbose function Tex_ViewLaTeX
In the second line of output (just above the function's body) is the location of where the function was defined.
I installed gVim 7.2 on windows and latex-suite, and miktex too
I tried what you said, after compile and view, I can view the dvi files
The error message seemed like to indicate it's the view's problem
The document for latex-suite said the viewer for Macintosh is not set, maybe it's where the problem lies
I think you can try to set a few variables in your .vimrc file, to set up the proper viewing app for PDF files
And the source code for Tex_ViewLaTeX is here:
http://www.tedpavlic.com/research_related/tpavlic_masters_thesis/compiler.vim
By the way, I also installed MacVim on my Macbook Pro, however I never used vim for LaTeXing, because I find TextMate and its latex bundle is much superior than MacVim, you'll definately like it
One way to search would be to do a grep or vimgrep on directory tree where you thought the source file was located. Search for 'function Tex_ViewLatex' or 'function! Tex_ViewLatex'.
I believe in the usual install it would be in a .../ftplugin/latex-suite/compiler.vim file, as part of the latex-suite plugin. There are a couple ftplugin directories, so make sure you get right one (one is in tree of main vim install and other may be off your home .vim directory.
It seems there is a bug with the Tex_ViewLatex function on OS X. Check here for some info:
http://comments.gmane.org/gmane.comp.editors.vim.latex.devel/775
Put this in your .vimrc, solved the problem for me.
let g:Tex_ViewRule_pdf = 'open -a Preview.app'

Resources