Help For Testing ruby on rails?

Hi guys

I am using Aptana IDE

How to do unit testing is there any sample explaining this

I got some tutorial but that is not complete as i am a beginner

Please guide me

karthik.k

To start with read

Sijo

Sijo Kg wrote:

To start with read

Testing Rails Applications — Ruby on Rails Guides

Sijo

Hi sijo

Thank you

I need to ask one thing
how to add data to database and check

As i am new to ruby on rails i dont know how to do this

karthik.k

Hi sijo

Thank you

Is there default testing technique or we need to install factory_girl
because what ever i do i need to pass all information to my client
So Is there default testing?


Karthik.k
Mobile - +91-9894991640

On Wed, Jul 22, 2009 at 1:53 PM, Sijo Kg

I need to ask one thing
how to add data to database and check

Hi

   You can use fixtures or the better Factories for this

Read this

Sijo

On Jul 22, 12:54 am, Karthik Kantharaj <rails-mailing-l…@andreas-
s.net> wrote:

Hi guys

I am using Aptana IDE

How to do unit testing is there any sample explaining this

I got some tutorial but that is not complete as i am a beginner

I just went through this experience myself and I will tell you that
there are many competing philosophies about testing, all of which use
similar or identical terminology to mean or assume significantly
different things. There is a vast overlap, but on a few crucial
details there are vital differences whose apparent importance is
magnified by the abysmal state of ones own ignorance. I found this to
be exceptionally confusing in the beginning and the source of much
misdirected effort on my part. For what it is worth I eventually
settled on continuous integration testing for my Rails project. For
this I use Cucumber, originally an offshoot of RSpec but now a
completely distinct and independent package.

The best places to start are the mailing lists devoted to testing. I
can recommend both the RSpec and Cuke lists as places where
extraordinarily knowledgeable and helpful people frequent. Both ML
are replicated at and can be joined through groups.google.com (http://
groups.google.com/group/rspec and http://groups.google.com/group/cukes).
There are also numerous self-help tutorials on the web. Just google
(rails ruby testing tutorial).

At my last count, Ryan B. screencasts at railscast.com provided no
fewer than ten episodes either directly about testing or having
testing as a significant component of his presentation. Plus there
is a treasure trove of other riches to be had at his site. Highly
recommended.

Recall to mind frequently that TDD/BDD is above all else a mental
approach to computer systems development. The three rules that I have
been taught are:

Write no production code AT ALL until you have a failing test.
Write only the minimal test that fails the current requirement, AND NO
MORE.
Write only enough production code to pass the test, AND NO MORE.

It is hard to say which of these rules is the hardest to follow. In
the beginning I suppose it has to be rule number one for most people.
But after a time that becomes routine and the danger of not following
rules two and three become evident. In truth, you must follow all
three rules at all times. TDD/BDD just does not happen until you do.
people call what they do TDD or BDD when they write tests, or specs or
features or whatever; but if they do not rigorously follow the canon
respecting what, when and how much code to write then they are really
not. It just superficially appears that they are.

The real test for yourself is the truthful answer to the question: Is
what I am doing HARD? If the answer is no then you are missing
something important (or are a savant). TDD and BDD is HARD. It is
VERY HARD. Because you have to cast your every design intent as a
programatically testable manifestation. That means you have to think
very carefully about precisely what you NEED to accomplish and HOW to
accomplish it, whereas most people spent most of the time thinking
about what they WANT to accomplish.

If you would like to see an excellent presentation on the grim
realities of practicing TDD, this forms the core of a very discursive
talk by Bob Martin given at RailsConf2009 entitled “What Killed
Smalltalk Could Kill Ruby, Too”, http://railsconf.blip.tv/file/2089545/.
You have to get past the first five minutes or so which, as far as I
could determine, have nothing to do with the subject of his
presentation. His assistant however, is the author of Cucumber.

Where can I find a reliable, experienced Ruby proammer for helping me
with an existing site built on Rails? Any thoughts
Sent from my Verizon Wireless BlackBerry

Hi
Thank you for your response
I gone through the links and your explanation but frankly speaking i
understood but not fully

I have one doubt

unit testing (For model)
what it does?(According to my knowledge)

  1. It inserts in to database an temporary data from fixtures
    something.yml
    when i run rake test:units

FunctionalTesting (For controller)
what it does?(According to my knowledge)
It checks if the controller is working correctly or not

But when i run rake test:functionals i have one method called

def test_should_create_post
assert_difference(‘Post.count’) do
post :create, :post => {:title=>“my”,:body=>“my body” }
end

but it is not adding to database

please tell me

  1. what unit test does
  2. what functional test does

    Karthik.k
    Mobile - +91-9894991640

unknown wrote:

Where can I find a reliable, experienced Ruby proammer for helping me
with an existing site built on Rails? Any thoughts

Yes. There are plenty on this list – but don’t hijack an existing
thread!

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

No need to be rude. I thought I was swnding you a PM
Sent from my Verizon Wireless BlackBerry

James B. wrote:
[…]

The real test for yourself is the truthful answer to the question: Is
what I am doing HARD? If the answer is no then you are missing
something important (or are a savant).

I’m going to disagree very strongly with you here. TDD certainly
takes discipline, and that may be hard at first. But once you do a
little and pick up the pattern, it is exhilaratingly easy, at least for
me.

So, I would say to ask yourself: is what I am doing HARD? If the answer
is yes, you have missed something. Learn the missing piece. Keep going
until it becomes easy. If it is hard, you are working too hard and you
need to stop and sharpen your saw.

TDD and BDD is HARD. It is

VERY HARD. Because you have to cast your every design intent as a
programatically testable manifestation.

Indeed.

That means you have to think
very carefully about precisely what you NEED to accomplish and HOW to
accomplish it,

No! Your tests should generally test the result, not the
implementation.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Hi
Thank you for your response
I gone through the links and your explanation but frankly speaking i
understood but not fully

I have one doubt

unit testing (For model)
what it does?(According to my knowledge)

  1. It inserts in to database an temporary data from fixtures
    something.yml
    when i run rake test:units

FunctionalTesting (For controller)
what it does?(According to my knowledge)
It checks if the controller is working correctly or not

But when i run rake test:functionals i have one method called

def test_should_create_post
assert_difference(‘Post.count’) do
post :create, :post => {:title=>“my”,:body=>“my body” }
end

but it is not adding to database

please tell me

  1. what unit test does
  2. what functional test does


Karthik.k
Mobile - +91-9894991640

On Thu, Jul 23, 2009 at 6:08 PM, Marnen Laibow-Koser <