-
Notifications
You must be signed in to change notification settings - Fork 0
Test Plan
#Test Plan for stock-quotes-and-recco
##Introduction
This is a test plan for the Stock-Quotes-and-Recco project. As of now, it only covers testing conducted by the author, Jeremiah Johnson, but this could change in the near future. The tests being performed currently are unit tests for the "Exchange Rates" component (within ComponentsTest.js in the test folder) as well as data from the Open Exchange Rates API (in serverTest.js). I have categorized these tests as "component", "server", and "automated" tests.
These tests were conducted using the Mocha, and selenium webdriver packages from the Node JS package manager.
##Scope
###General
The tests which I have created can be broken down into the categories: component, server, and automated tests. The component test, covers all of the tests which will be performed within the component, the server test performs tests while it has a connection to the server, and the automated tests generate tests that will cover component tests from the local host server.
The 'Exchange Rates' component, is the only component being tested (in the componentsTest file) as of the current writing of this test plan. The goal of it is to convert a user-inputted currency, from US dollars, to its equivalent foreign currency. It contains the following features:
- Two Input Fields (for entering in a US currency and displaying the converted output)
- A Select Option (for choosing a foreign currency)
The single server test being conducted is for validating the exchange rates data collected from the 'Open Exchange Rates' API. These include the base currency (USD) and each of the foreign currency values - European Euro (Euro), British Pound (BPD), and Japanese Yuan (Yuan) -.
The automated tests cover unit tests that are performed when the local server has been connected. These include the ability to navigate to the Home page and every other page as displayed in the Navigation Bar header. The login and registration forms have been left out of this testing process.
###Tactics
Each test currently follows this criteria:
For Unit Tests for the server
-
Open a connection to the server
-
Retrieve the data from the server
-
Verify the contents of the retrieved data
For Unit Tests with Mocha + JSDOM
-
Render a component
-
Find existing data
-
Verify the contents of this existing data
For Unit Tests with Selenium Web Driver
-
Navigate to a page
-
Check for content on page
-
Navigate to the next page
##Testing Strategy
###Unit Testing
####Definition
To perform these tests requires knowledge of using the Node JS package manager, and how assertions work.
Other than having Node JS, one needs to install the following Node packages:
-
Mocha
-
JS Dom
-
Expect
-
react-addons-test-utils
-
react
-
React DOM
-
Babel Core (version 6)
-
Selenium Webdriver
Note: Mocha by default does not contain DOM support when testing components, so this is why JS DOM is needed (refer to the description after the renderIntoDocument method in Facebook's TestUtils class). Babel core (version 6) is required in order for the mocha test command to run correctly (see the Running Tests section in the project README file for more information).
####Methodology
###Test Cases
The following tables detail each test case, from the files in the Test folder, and its expected result:
Server Tests (from serverTest)
| Test Case(s) | Steps | Expected Results | Status (Pass/Fail) |
|---|---|---|---|
| Test Case | 1.0 Retrieve Exchange Rates from API |
- | Navigate to the Open Exchange Rates API link |
- | Check that USD dollar value exists on the site. | The default base USD value. | Pass
- | Check that Euro dollar value exists on the site. | The current European exchange rate value. | Pass
- | Check that Japanese Yuan dollar value exists on the site. | The current Japanese Yuan exchange rate value. | Pass
- | Check that British Pound dollar value exists on the site. | The current British Pound exchange rate value. | Pass
Exchange Rates Tests(from ComponentsTest)
| Test Case(s) | Steps | Expected Results | Status (Pass/Fail) |
|---|---|---|---|
| Test Case | 2.0 Exchange Rates Component Tests |
- | Check for a rendered Exchange Rates component | An existing 'Exchange Rates' component. | Pass
- | Check for a selection menu | An existing selection menu. | Pass
- | Check that the selection menu has four options | The length of the selection menu's choices is four. (empty, EUR, JPY, BPD) | Pass
- | Check that the values of the drop-down menu are: EUR, GBP, and JPY. | Each foreign currency value should be found. | Pass
- | Search for two input fields | Both input fields should be detected | Pass
- | Check that a US Currency value has been entered in the first input field | The sample number should be detected as being entered within the input field. | Pass
- | Check that a converted currency value is a number | The sample converted currency value, in the second input field, should be a number value. | Pass
Automated Tests (from autoTests)
| Test Case(s) | Steps | Expected Results | Status (Pass/Fail) |
|---|---|---|---|
| Test Case | 3.0 Connecting to the Home Page |
- | Search for the Home Page Title. | The home page should exist by detecting it's page title "Stock Quotes and Recco Toy App" | Pass
- | Search for the Navigation Bar header | The navigation bar header should exist. | Pass
- | Navigate to StocksPage by clicking on link, StockPage, and checking for Stocks classname. | The mouse should click on the StocksPage link, in the navigation bar, and redirect to the StocksPage. | Pass Test Case | 4.0 Stock List Page |
- | Check for StockList Page title | The page title for the StockList page should be detected. | Pass
- | Search for an input field. | A input field should be detected on the page. | Pass
- | Search for the BUY button. | The BUY button should be detected on the page. | Pass
- | Search for all stock options. | All stocks should be detected on the page. | Pass
- | Navigate to the Study Page by clicking on its link. | The mouse should click on the Study Page link in the navigation bar and find the Study Page title by its className, "Study Tracker". | Pass Test Case | 5.0 Study Page |
- | Find the button. | The button on the page should be found. | Pass
- | Navigate to the Exchange Rates Page by clicking on its link. | The mouse should find the link for the Currency Converter page, and click it. After the page has been navigated to, its page title should be found. | Pass Test Case | 6.0 Exchange Rates Page |
- | Search for a selection menu. | The selection menu should be found | Pass
- | Search for the input field for entering in the US currency. | The first input field should be found. | Pass
- | Search for an input field for displaying the foreign currency. | The second input should be found. | Pass
- | Navigate back to the Home Page by clicking on its link. | The mouse should find and click the link to go to the homepage. After redirecting to the homepage, the 'Stock Quotes and Recco Toy App' page title should be detected. | Pass
###Demo
To run tests requires the use of the command:
mocha --require test/setup.js --compilers js:babel-registerThe 'setup.js' file contains the configuration of fake DOMs used in the simulation of the 'Exchange Rates' component (see the Note in the previous section). When testing, the 'componentsTest' file is ran first, followed by the 'autoTests' file. The unit tests created follow the outline as described in the list from the tactics section. The test files are located within the 'test' folder of the main project.
See the image below of the expected output for both component and automated tests:
