SlideShare a Scribd company logo
1 of 4
Download to read offline
IV­Review :: Test Case

       Rails generate a framework for unit and functional tests. You can get pretty good test 
coverage by filling in the framework with tests for the functionality you write. There are two 
important points to test in a Rails application:
    • Testing the Models.
    • Testing the Controllers.

Testing Models:
        When you generate a model with the generate script, Rails also generates a unit test script for 
the model in the test directory. It also creates a fixture, a yaml file containing test data to be loaded 
into the testapp_test database.


Unit Test:
        A test of individual programs or modules in order to ensure that there are no analysis or 
programming errors is known as unit testing. As in other languages, Ruby provides a framework in 
its standard library for setting up, organizing and running tests called Test::Unit. An unit testing 
provides three basic functionalities:

           •   A way to define basic pass/fail tests.
           •   A say to gather like tests together and run them as a group
           •   Tools for running single tests or whole groups of tests.

Code for Unit Testing:

    require 'test_helper' 
    class ApplicantTest < ActiveSupport::TestCase 
      testsome_undefined_variable 
      assert true  "should not save without email_id" do 
      applicant = Applicant.new 
      assert !applicant.save 
      some_undefined_variable 
      assert true 
      end 
   end

In terminal
Unit Testing Case Summary:

    Test case id        Description        Expected Results       Actual Results            Status
1                   Enter the email_id     It should raise      It is not accepting Pass
                    as Blank               error
2                   Enter email_id with  It should accept to  It is not accept       Fail
                    varchar(20)          proceed              more then 20
3                   Enter email_id with  It should accept to  It is not accepting  Pass
                    special characters   proceed
4                   Enter a email_id       It should accept to  It is not accepting  Fail
                    with numerical         proceed


Testing Controllers:
        Controller testing is also known as functional testing. Functional testing 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? 


Functional Test:
         Functional testing is a type of Black box testing that bases its test cases on the specifications 
of the software component under test. Functions are tested by feeding them input and examining the 
output, and internal program structure is rarely considered.

Code for Functional Testing:

  require 'test_helper' 
  class MailersControllerTest < ActionController::TestCase 
  setup do 
    @user = users(:one) 
  end 

  test "should get index" do 
    get :index 
    assert_response :success 
    assert_not_nil assigns(:users) 
  end 

  test "should get new" do 
    get :new 
    assert_response :success 
  end 
  test "should create user" do 
    assert_difference('User.count') do 
      post :create, :user => @user.attributes 
    end 

    assert_redirected_to user_path(assigns(:user)) 
  end 

  test "should show user" do 
    get :show, :id => @user.to_param 
    assert_response :success 
  end 

  test "should get edit" do 
    get :edit, :id => @applicant.to_param 
    assert_response :success 
  end 

  test "should update applicant" do 
    put :update, :id => @user.to_param, :user => @user.attributes 
    assert_redirected_to user_path(assigns(:user)) 
  end 
 
 test "should destroy user" do 
    assert_difference('User.count', ­1) do 
      delete :destroy, :id => @user.to_param 
    end 
    assert_redirected_to users_path 
  end 
 end

In Terminal:
Functional Testing Case Summary:

    Test case id         Description       Expected Results       Actual Results             Status
1                    Get index             It should get index  It is accepting/   Pass
                                           page/ if is not get display page error 
2                    Get new               It should diplay     It is accepting       Pass
                                           create page
3                    Get new/submit        It should create     Its accepting/not     Pass/Fail
                                           record/not create    accepting
4                    Get show              It should display    Its accepting         Pass
                                           created record
5                    Get destroy           I should delete      Its accepting         Pass
                                           selected record




Using Rake for testing:
      We can use rake utility to test our applications by Various kind of testing strategy. Here are 
few important 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:


Some Rake Utility:
    • $rake db:test:clone ­ Recreate the test database from the current environment's database 
      schema.
    • $rake db:test:clone_structure ­ Recreate the test databases from the development structure.
    • $rake db:test:prepare ­ Prepare the test database and load the schema.
    • $rake db:test:purge ­ Empty the test database.

More Related Content

What's hot

QTP&UFT Automation Framework
QTP&UFT Automation FrameworkQTP&UFT Automation Framework
QTP&UFT Automation FrameworkYu Tao Zhang
 
Software testing and_quality_assurance_powerpoint_presentation
Software testing and_quality_assurance_powerpoint_presentationSoftware testing and_quality_assurance_powerpoint_presentation
Software testing and_quality_assurance_powerpoint_presentationvigneshasromio
 
Sqa, test scenarios and test cases
Sqa, test scenarios and test casesSqa, test scenarios and test cases
Sqa, test scenarios and test casesConfiz
 
Keyword-driven Test Automation Framework
Keyword-driven Test Automation FrameworkKeyword-driven Test Automation Framework
Keyword-driven Test Automation FrameworkMikhail Subach
 
Automation framework
Automation framework Automation framework
Automation framework ITeLearn
 
14.web forms server controls
14.web forms server controls14.web forms server controls
14.web forms server controlsPramod Rathore
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering Madhar Khan Pathan
 
Testing check list
Testing check listTesting check list
Testing check listAtul Pant
 
UFT Automation Framework Introduction
UFT Automation Framework IntroductionUFT Automation Framework Introduction
UFT Automation Framework IntroductionHimal Bandara
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering Madhar Khan Pathan
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering Madhar Khan Pathan
 
RIA 05 - Unit Testing by Ajinkya Prabhune
RIA 05 - Unit Testing by Ajinkya PrabhuneRIA 05 - Unit Testing by Ajinkya Prabhune
RIA 05 - Unit Testing by Ajinkya PrabhuneJohannes Hoppe
 
Basic Database Testing
Basic Database TestingBasic Database Testing
Basic Database TestingKumar S
 
Defects in software testing
Defects in software testingDefects in software testing
Defects in software testingsandeepsingh2808
 
Software Testing Strategies
Software Testing StrategiesSoftware Testing Strategies
Software Testing StrategiesAlpana Bhaskar
 

What's hot (20)

QTP&UFT Automation Framework
QTP&UFT Automation FrameworkQTP&UFT Automation Framework
QTP&UFT Automation Framework
 
Testing strategies
Testing strategiesTesting strategies
Testing strategies
 
Software testing and_quality_assurance_powerpoint_presentation
Software testing and_quality_assurance_powerpoint_presentationSoftware testing and_quality_assurance_powerpoint_presentation
Software testing and_quality_assurance_powerpoint_presentation
 
Test design techniques
Test design techniquesTest design techniques
Test design techniques
 
Software Evaluation
Software EvaluationSoftware Evaluation
Software Evaluation
 
Sqa, test scenarios and test cases
Sqa, test scenarios and test casesSqa, test scenarios and test cases
Sqa, test scenarios and test cases
 
Keyword-driven Test Automation Framework
Keyword-driven Test Automation FrameworkKeyword-driven Test Automation Framework
Keyword-driven Test Automation Framework
 
Automation framework
Automation framework Automation framework
Automation framework
 
14.web forms server controls
14.web forms server controls14.web forms server controls
14.web forms server controls
 
Data validation option
Data validation optionData validation option
Data validation option
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering
 
Testing check list
Testing check listTesting check list
Testing check list
 
UFT Automation Framework Introduction
UFT Automation Framework IntroductionUFT Automation Framework Introduction
UFT Automation Framework Introduction
 
Test cases
Test casesTest cases
Test cases
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering
 
RIA 05 - Unit Testing by Ajinkya Prabhune
RIA 05 - Unit Testing by Ajinkya PrabhuneRIA 05 - Unit Testing by Ajinkya Prabhune
RIA 05 - Unit Testing by Ajinkya Prabhune
 
Basic Database Testing
Basic Database TestingBasic Database Testing
Basic Database Testing
 
Defects in software testing
Defects in software testingDefects in software testing
Defects in software testing
 
Software Testing Strategies
Software Testing StrategiesSoftware Testing Strategies
Software Testing Strategies
 

Similar to Query Management system-Iv review

Rails Testing
Rails TestingRails Testing
Rails Testingmikeblake
 
Automated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choiceAutomated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choicetoddbr
 
Testing Legacy Rails Apps
Testing Legacy Rails AppsTesting Legacy Rails Apps
Testing Legacy Rails AppsRabble .
 
Unit testing in Force.com platform
Unit testing in Force.com platformUnit testing in Force.com platform
Unit testing in Force.com platformChamil Madusanka
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with SeleniumDave Haeffner
 
Testing in Craft CMS
Testing in Craft CMSTesting in Craft CMS
Testing in Craft CMSJustinHolt20
 
Ruby on rails integration testing with minitest and capybara
Ruby on rails integration testing with minitest and capybaraRuby on rails integration testing with minitest and capybara
Ruby on rails integration testing with minitest and capybaraAndolasoft Inc
 
Software Testing
Software TestingSoftware Testing
Software TestingAdroitLogic
 
Unit testing php-unit - phing - selenium_v2
Unit testing   php-unit - phing - selenium_v2Unit testing   php-unit - phing - selenium_v2
Unit testing php-unit - phing - selenium_v2Tricode (part of Dept)
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfullyTEST Huddle
 
Test cases and bug report v3.2
Test cases and bug report v3.2Test cases and bug report v3.2
Test cases and bug report v3.2Andrey Oleynik
 
Code igniter unittest-part1
Code igniter unittest-part1Code igniter unittest-part1
Code igniter unittest-part1Albert Rosa
 
www.tutorialsbook.com presents Manual testing
www.tutorialsbook.com presents Manual testingwww.tutorialsbook.com presents Manual testing
www.tutorialsbook.com presents Manual testingTutorials Book
 
Principles and patterns for test driven development
Principles and patterns for test driven developmentPrinciples and patterns for test driven development
Principles and patterns for test driven developmentStephen Fuqua
 
Testing the Untestable
Testing the UntestableTesting the Untestable
Testing the UntestableMark Baker
 

Similar to Query Management system-Iv review (20)

Rails Testing
Rails TestingRails Testing
Rails Testing
 
Automated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choiceAutomated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choice
 
Presentation
PresentationPresentation
Presentation
 
Testing Legacy Rails Apps
Testing Legacy Rails AppsTesting Legacy Rails Apps
Testing Legacy Rails Apps
 
Unit testing in Force.com platform
Unit testing in Force.com platformUnit testing in Force.com platform
Unit testing in Force.com platform
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with Selenium
 
Testing in Craft CMS
Testing in Craft CMSTesting in Craft CMS
Testing in Craft CMS
 
Ruby on rails integration testing with minitest and capybara
Ruby on rails integration testing with minitest and capybaraRuby on rails integration testing with minitest and capybara
Ruby on rails integration testing with minitest and capybara
 
Testing Guide
Testing GuideTesting Guide
Testing Guide
 
Testing Angular
Testing AngularTesting Angular
Testing Angular
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
Unit testing php-unit - phing - selenium_v2
Unit testing   php-unit - phing - selenium_v2Unit testing   php-unit - phing - selenium_v2
Unit testing php-unit - phing - selenium_v2
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfully
 
Test cases and bug report v3.2
Test cases and bug report v3.2Test cases and bug report v3.2
Test cases and bug report v3.2
 
Code igniter unittest-part1
Code igniter unittest-part1Code igniter unittest-part1
Code igniter unittest-part1
 
www.tutorialsbook.com presents Manual testing
www.tutorialsbook.com presents Manual testingwww.tutorialsbook.com presents Manual testing
www.tutorialsbook.com presents Manual testing
 
Testing methodology
Testing methodologyTesting methodology
Testing methodology
 
Principles and patterns for test driven development
Principles and patterns for test driven developmentPrinciples and patterns for test driven development
Principles and patterns for test driven development
 
Testing the Untestable
Testing the UntestableTesting the Untestable
Testing the Untestable
 

More from logeshprabu

Kanchi LUG history
Kanchi LUG historyKanchi LUG history
Kanchi LUG historylogeshprabu
 
Query Management System- overview
Query Management System- overviewQuery Management System- overview
Query Management System- overviewlogeshprabu
 
Query Management system-IIIrd Review
Query Management system-IIIrd ReviewQuery Management system-IIIrd Review
Query Management system-IIIrd Reviewlogeshprabu
 
Query Management system-IInd Review
Query Management system-IInd ReviewQuery Management system-IInd Review
Query Management system-IInd Reviewlogeshprabu
 
Query Management system-Ist review
Query Management system-Ist reviewQuery Management system-Ist review
Query Management system-Ist reviewlogeshprabu
 
Cloud comptuting
Cloud comptutingCloud comptuting
Cloud comptutinglogeshprabu
 

More from logeshprabu (7)

Kanchi LUG history
Kanchi LUG historyKanchi LUG history
Kanchi LUG history
 
Query Management System- overview
Query Management System- overviewQuery Management System- overview
Query Management System- overview
 
Query Management system-IIIrd Review
Query Management system-IIIrd ReviewQuery Management system-IIIrd Review
Query Management system-IIIrd Review
 
Logesh resume
Logesh resumeLogesh resume
Logesh resume
 
Query Management system-IInd Review
Query Management system-IInd ReviewQuery Management system-IInd Review
Query Management system-IInd Review
 
Query Management system-Ist review
Query Management system-Ist reviewQuery Management system-Ist review
Query Management system-Ist review
 
Cloud comptuting
Cloud comptutingCloud comptuting
Cloud comptuting
 

Recently uploaded

Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 

Recently uploaded (20)

Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 

Query Management system-Iv review

  • 1. IV­Review :: Test Case Rails generate a framework for unit and functional tests. You can get pretty good test  coverage by filling in the framework with tests for the functionality you write. There are two  important points to test in a Rails application: • Testing the Models. • Testing the Controllers. Testing Models: When you generate a model with the generate script, Rails also generates a unit test script for  the model in the test directory. It also creates a fixture, a yaml file containing test data to be loaded  into the testapp_test database. Unit Test: A test of individual programs or modules in order to ensure that there are no analysis or  programming errors is known as unit testing. As in other languages, Ruby provides a framework in  its standard library for setting up, organizing and running tests called Test::Unit. An unit testing  provides three basic functionalities: • A way to define basic pass/fail tests. • A say to gather like tests together and run them as a group • Tools for running single tests or whole groups of tests. Code for Unit Testing:     require 'test_helper'      class ApplicantTest < ActiveSupport::TestCase        testsome_undefined_variable        assert true  "should not save without email_id" do        applicant = Applicant.new        assert !applicant.save        some_undefined_variable        assert true        end     end In terminal
  • 2. Unit Testing Case Summary: Test case id Description Expected Results Actual Results Status 1 Enter the email_id  It should raise  It is not accepting Pass as Blank error 2 Enter email_id with  It should accept to  It is not accept  Fail varchar(20) proceed more then 20 3 Enter email_id with  It should accept to  It is not accepting  Pass special characters proceed 4 Enter a email_id  It should accept to  It is not accepting  Fail with numerical proceed Testing Controllers: Controller testing is also known as functional testing. Functional testing 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?  Functional Test:  Functional testing is a type of Black box testing that bases its test cases on the specifications  of the software component under test. Functions are tested by feeding them input and examining the  output, and internal program structure is rarely considered. Code for Functional Testing:   require 'test_helper'    class MailersControllerTest < ActionController::TestCase    setup do      @user = users(:one)    end    test "should get index" do      get :index      assert_response :success      assert_not_nil assigns(:users)    end    test "should get new" do      get :new      assert_response :success    end 
  • 3.   test "should create user" do      assert_difference('User.count') do        post :create, :user => @user.attributes      end      assert_redirected_to user_path(assigns(:user))    end    test "should show user" do      get :show, :id => @user.to_param      assert_response :success    end    test "should get edit" do      get :edit, :id => @applicant.to_param      assert_response :success    end    test "should update applicant" do      put :update, :id => @user.to_param, :user => @user.attributes      assert_redirected_to user_path(assigns(:user))    end     test "should destroy user" do      assert_difference('User.count', ­1) do        delete :destroy, :id => @user.to_param      end      assert_redirected_to users_path    end   end In Terminal:
  • 4. Functional Testing Case Summary: Test case id Description Expected Results Actual Results Status 1 Get index It should get index  It is accepting/ Pass page/ if is not get display page error  2 Get new It should diplay  It is accepting Pass create page 3 Get new/submit It should create  Its accepting/not  Pass/Fail record/not create accepting 4 Get show It should display  Its accepting Pass created record 5 Get destroy I should delete  Its accepting Pass selected record Using Rake for testing: We can use rake utility to test our applications by Various kind of testing strategy. Here are  few important 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: Some Rake Utility: • $rake db:test:clone ­ Recreate the test database from the current environment's database  schema. • $rake db:test:clone_structure ­ Recreate the test databases from the development structure. • $rake db:test:prepare ­ Prepare the test database and load the schema. • $rake db:test:purge ­ Empty the test database.