I'm trying to use the new WebSpec mocks do write some unit tests and I
get this error:
WebSpec is not a member of net.liftweb.mocks
This is the relevant sections on my sbt projecgt file:
===================
val liftVersion = "2.3-SNAPSHOT"
val scalaToolsSnapshots = "Scala-Tools Maven2 Snapshots Repository"
at "http://scala-tools.org/repo-snapshots"
override def libraryDependencies = Set(
"net.liftweb" %% "lift-webkit" % liftVersion % "compile->default",
"net.liftweb" %% "lift-testkit" % liftVersion % "compile->default",
"net.liftweb" %% "lift-widgets" % liftVersion % "compile->default",
"net.liftweb" %% "lift-mapper" % liftVersion % "compile->default",
"net.liftweb" %% "lift-ldap" % liftVersion % "compile->default",
"net.liftweb" %% "lift-json" % liftVersion % "compile->default",
"org.mortbay.jetty" % "jetty" % "6.1.22" % "test->default",
"junit" % "junit" % "4.5" % "test->default",
"org.mockito" % "mockito-core" % "1.8.5" % "test->default",
"org.scala-tools.testing" %% "specs" % "1.6.6" % "test->default",
"mysql" % "mysql-connector-java" % "5.1.14" % "compile->default",
"ch.qos.logback" % "logback-classic" % "0.9.26" % "compile->default",
"commons-dbcp" % "commons-dbcp" % "1.4" % "compile->default"
) ++ super.libraryDependencies
===============
Inside sbt I run:
clean
clean-lib
update
test
and here I get the error.
Thanks
Diego
--
Diego Medina
Web Developer
http://www.fmpwizard.com
--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Feel encouraged to skip review board and just get this into master asap.
Playing daddy daycare until this evening, but it's my #1 priority as soon as I can get to it.
Thanks!
Diego Medina
Diego
On Mon, Jan 31, 2011 at 10:52 PM, Derek Chen-Becker
On Tue, Feb 1, 2011 at 1:24 AM, Derek Chen-Becker <dchen...@gmail.com> wrote:
> Good to hear. My priority going forward is to improve the testing experience
> with Lift, so any feedback on what's in place now, what is missing, and
> other ideas for making it better are greatly appreciated.
I have added several tests that use the pattern
... withSFor(testReq) ...
and it is working real well. Very easy to setup and clear to see what
is being tested.
One thing that I'm not sure how it could be avoided or improved is
that I find myself writing tests like this:
"display the version number" withSFor(testReq) in {
val serviceManagerDetails = new ServiceManagerDetails
serviceManagerDetails.renderServiceManagerResult(
<h2>Service Manager results for version: </h2>
).toString mustEqual(<h2>Service Manager results for version:
2.4.0.1090</h2>).toString
}
(ignore the .toString for a moment, but what I see is that if on my
real html page, I change the h2 for an h3, my tests will still pass, I
would have to manually keep m tests and html pages in sync.
This is a minimalist example, but I have some tests that have a lot of
html in them. So, having some way to "use" the real html pages on my
tests would be better, but I'm not sure how to really do that.
Again, thanks for the great work you have done!
Diego
>> >> >>>> >> liftweb+u...@googlegroups.com<liftweb%2B...@googlegroups.com>
>> >> >>>>
>> >> >>>>
>> >> >>>> <liftweb%2B...@googlegroups.com<liftweb%252...@googlegroups.com>
>> >> >>>> >
>> >> >>>> >> .
>> >> >>>> >> For more options, visit this group at
>> >> >>>> >> http://groups.google.com/group/liftweb?hl=en.
>> >> >>>> >>
>> >> >>>> >>
>> >> >>>> >
>> >> >>>> > --
>> >> >>>> > You received this message because you are subscribed to the
>> >> >>>> Groups "Lift" group.
>> >> >>>> > To post to this group, send email to lif...@googlegroups.com.
>> >> >>>> > To unsubscribe from this group, send email to
>> >> >>>>
>> >> >>>>
>> >> >>>> liftweb+u...@googlegroups.com<liftweb%2B...@googlegroups.com>
>> >> >>>> .
>> >> >>>> > For more options, visit this group at
>> >> >>>> http://groups.google.com/group/liftweb?hl=en.
>> >> >>>> >
>> >> >>>>
>> >> >>>> --
>> >> >>>> You received this message because you are subscribed to the Google
>> >> >>>> Groups
>> >> >>>> "Lift" group.
>> >> >>>> To post to this group, send email to lif...@googlegroups.com.
>> >> >>>> To unsubscribe from this group, send email to
>> >> >>>>
>> >> >>>>
>> >> >>>> liftweb+u...@googlegroups.com<liftweb%2B...@googlegroups.com>
>> >> >>>> .
>> >> >>>> For more options, visit this group at
>> >> >>>> http://groups.google.com/group/liftweb?hl=en.
>> >> >>>>
>> >> >>>> --
>> >> >>>> You received this message because you are subscribed to the Google
>> >> >>>> Groups
>> >> >>>> "Lift" group.
>> >> >>>> To post to this group, send email to lif...@googlegroups.com.
>> >> >>>> To unsubscribe from this group, send email to
>> >> >>>>
>> >> >>>>
>> >> >>>> liftweb+u...@googlegroups.com<liftweb%2B...@googlegroups.com>
>> >> >>>> .
>> >> >>>> For more options, visit this group at
>> >> >>>> http://groups.google.com/group/liftweb?hl=en.
>> >> >>>>
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> --
>> >> >>> Lift, the simply functional web framework http://liftweb.net
>> >> >>> Beginning Scala http://www.apress.com/book/view/1430219890
>> >> >>> Follow me: http://twitter.com/dpp
>> >> >>> Blog: http://goodstuff.im
>> >> >>> Surf the harmonics
>> >> >>>
>> >> >>> --
>> >> >>> You received this message because you are subscribed to the Google
>> >> >>> Groups
>> >> >>> "Lift" group.
>> >> >>> To post to this group, send email to lif...@googlegroups.com.
>> >> >>> To unsubscribe from this group, send email to
>> >> >>>
>> >> >>>
>> >> >>> liftweb+u...@googlegroups.com<liftweb%2B...@googlegroups.com>
Thanks both of you for the answer, this is what I have not, but I must
be missing something. What I have is:
val testReq =
new MockHttpServletRequest(
"http://127.0.0.1:8080/agent-details/2.4.0.1090", ""
)
"display service manager test results, all FAIL" withSFor(testReq) in {
val agentDetails = new AgentDetails
val res= Full(List(Map("N/A"->("N/A", "N/A"))))
S.runTemplate(List("agent-details.html"))
agentDetails.testResults.doWith(
Box[List[Map[String,(String, String)]]](
List(
Map("RHEL5 64bit"->("RHEL5", "FAIL")),
Map("RHEL5 64bit"->("RHEL5", "FAIL")),
Map("RHEL5 64bit"->("RHEL5", "FAIL")),
Map("RHEL5 64bit"->("RHEL5", "FAIL")),
Map("RHEL5 64bit"->("RHEL5", "FAIL")),
Map("RHEL5 64bit"->("RHEL5", "FAIL")),
Map("RHEL5 64bit"->("RHEL5", "FAIL"))
)
)
){
agentDetails.renderAgentResult mustEqual(<some html here>)
and specs fails telling me (short version)
[error] x display service manager test results, all FAIL
[error] '<[]f[u]n[c]t[]i[]o[]n[1]>[]' is not equal to 'my expected
html here'
Thanks
Diego
[error] x display service manager test results, all FAIL
[error] 'Failure(Couldn't find template
List(agent-details),Empty,Empty)' is not equal to '<html here>'
(AgentDetailsTestSpecs.scala:80)
and I have a file in
./src/main/webapp/agent-details.html
and just in case here too:
./src/main/webapp/templates-hidden/agent-details.html
What i'm trying to do is see if my snippet converts the page to what I
expect, I see that the definition of runTemplate also has a snips
parameter, which I don;t know if I'm supposed to use or not.
Later tonight I'll post a sample app so that you can see what I see,
maybe I'm omitting some important detail.
Thanks
Diego
On Thu, Feb 10, 2011 at 2:20 PM, Derek Chen-Becker
Ok, sample app is here:
https://github.com/fmpwizard/specs-lift
run
git clone git://github.com/fmpwizard/specs-lift.git
cd specs-lift
sbt
update
~test-only code.snippet.AgentDetailsTestSpecs
and you will see
[error] x AgentDetails should
[error] x display service manager test results, all FAIL
[error] 'Failure(Couldn't find template
List(agent-details),Empty,Empty)' is not equal to 'temp'
(AgentDetailsTestSpecs.scala:70)
I copied the agent-details.html file to the test/webapp folder and I
still get the error :(
Thanks for looking into this
Diego
On Thu, Feb 10, 2011 at 11:12 PM, Derek Chen-Becker
Thanks !
I'll try it later tonight.
Diego Medina
Thanks very much.
Diego
That sounds like a great addition, would it be possible to combine it
with a withSFor(...) as well?
something along the lines of:
"my simple test" withTemplateFor("html-template") withSFor(testReq) in {
val snippet = new SnippetClass
snippet.renderMethod mustEqual(<complete html template parsed by lift>)
}
Thanks
Diego