CSC/ECE 517 Fall 2011/ch4 4e cl: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
(Blanked the page)
Line 1: Line 1:
CSC/ECE 517 Fall 2010/ch1 4e cl
----
=Introduction=
In this Wiki, we introduce the testing in Ruby Rails. We give brief introduction of different kinds of tests and give the procedure about each kind.


=What is Software Test=
Software testing is an investigation conducted to provide stakeholders with information about the quality of the product or service under test.[1] Software testing can also provide an objective, independent view of the software to allow the business to appreciate and understand the risks of software implementation. Test techniques include, but are not limited to, the process of executing a program or application with the intent of finding software bugs (errors or other defects).
Software testing can be stated as the process of validating and verifying that a software program/application/product:
meets the requirements that guided its design and development;
works as expected; and
can be implemented with the same characteristics.
Software testing, depending on the testing method employed, can be implemented at any time in the development process. However, most of the test effort occurs after the requirements have been defined and the coding process has been completed. As such, the methodology of the test is governed by the software development methodology adopted.<ref>http://en.wikipedia.org/wiki/Software_testing</ref>
=What is Rails=
=Why need Software Test for Rails Application=
Ruby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language.
Rails makes it super easy to write your tests. It starts by producing skeleton test code in the background while you are creating your models and controllers.
By simply running your Rails tests you can ensure your code adheres to the desired functionality even after some major code refactoring.
Rails tests can also simulate browser requests and thus you can test your application’s response without having to test it through your browser.
=What support provided by Rails=
=Basic Introduction=
==Set Up==
There is a folder named "test" which is generate when create the Rail projects.
To list contents of this folder
$ ls -F test/
We can see:
fixtures/      functional/    integration/    test_helper.rb  unit/
==The Low-Down on Fixtures==
===What is a Fixture===
Test fixture refers to the fixed state used as a baseline for running tests in software testing. The purpose of a test fixture is to ensure that there is a well known and fixed environment in which tests are run so that results are repeatable.<ref>http://en.wikipedia.org/wiki/Test_fixture</ref>For good tests, you’ll need to give some thought to setting up test data. In Rails, you can handle this by defining and customizing fixtures.
=Category=
==Unit Testing==
==Functional Testing==
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.
In Rails, testing the various actions of a single controller is called writing functional tests for that controller. Controllers handle the incoming web requests to your application and eventually respond with a rendered view.
===What to Include in Functional Tests===
1.was the web request successful?
2.was the user redirected to the right page?
3.was the user successfully authenticated?
4.was the correct object stored in the response template?
5.was the appropriate message displayed to the user in the view?
===Available Request Types for Functional Tests===
1.get
2.post
3.put
4.head
5.delete
===The Four Hashes of the Apocalypse===
1.assigns
2.cookies
3.flash
4.session
== Integration Testing==
= Conclusion =
= References =
----
<references/>

Revision as of 03:59, 20 October 2011