Query Management System Name : Logeshprabu.S Class : MCA Review : IV Date : 11.04.11 Guide : Mr.V.Senthilkumar
Testing Methods in Rails! Testing Models: A Model testing is also known as Unit testing. A test of individual programs or modules in order to ensure that there are no analysis or programming errors is known as Model( unit ) testing. An unit testing provides three basic functionalities: 1.A way to define basic pass/fail tests. 2.A say to gather like tests together and run them as a group 3.Tools for running single tests or whole groups of tests.
Testing Controllers: Controller testing is also known as functional testing. Functions are tested by feeding them input and examining the output, and internal program structure is rarely considered. It tests the following type of functionalities of the controllers: Is the response redirected as expected ? Is the expected template rendered? Is the routing as expected Does the response contain the expected tags?
Summary of Unit Testing case Test case id Description Expected Results Actual Results Status 1 Enter the email_id as Blank It should raise error It is not accepting Pass 2 Enter email_id with varchar(20) It should accept to proceed It is not accept more then 20 Fail 3 Enter email_id with special characters It should accept to proceed It is not accepting Pass 4 Enter a email_id with numerical It should accept to proceed It is not accepting Fail
Summary of Functional Testing case Test case id Description Expected Results Actual Results Status 1 Get index It should get index page/ if is not get It is accepting/ display page error Pass 2 Get new It should diplay create page It is accepting Pass 3 Get new/submit It should create record/not create Its accepting/not accepting Pass/Fail 4 Get show It should display created record Its accepting Pass 5 Get destroy I should delete selected record Its accepting Pass
Rails Test Commands $rake test - Test all unit tests and functional tests (and integration tests, if they exist). $rake test:functionals - Run all functional tests. $rake test:units - Run all unit tests. $rake test:integration - Run all integration tests. $rake test:plugins - Run all test in ./vendor/plugins/**/test. $rake test:recent - Run tests for models and controllers that have been modified in the last 10 minutes.