Testing

A crucial component of any software project is testing. Testing is the most important way for designers and programmers to demonstrate a tool's robustness and versatility. The goal of every testing suite is to convince the developer team and any outside observers that the product works and is safe to use. The more complex a project, the more important good testing becomes. Our project, which features a built-out front-end and back-end, implements several forms of tests.

Front-End Code Tests

These tests ensure that individual components are present on a page. The goal of unit tests is to test individual components of a solution. These tests catch problems before they can take down the entire project or site. Furthermore, unit tests allow us to determine exactly where a problem occurs, rather than us simply knowing that a problem has occurred. Our front-end unit tests inspect each site for various components – is a picture where it is supposed to be? Are the bills we expect to be associated with a representative where they are supposed to be? Are the correct parties featured? We use Mocha to run our front-end unit tests. Mocha allows us to run multiple front-end unit tests in a way that prevents a failing test from affecting any other test. Our front-end code tests can be accessed through the frontend/tests.js symbolic link.

Front-End GUI Tests

These tests ensure that our website components work together. As opposed to unit tests, acceptance tests demonstrate that our website, as a whole, is functional. These tests catch problems that unit tests on their own have difficulty finding. Our front-end GUI tests focus on page and model interconnectedness and website navigability. Does one model's instance page connect to other models? Does an instance page lead back to a grid page? We use Selenium to run our front-end acceptance tests. Selenium allows us to spin up a web driver and click around on a page like a normal user. Our front-end GUI tests can be accessed through the frontend/guitests.js symbolic link.

Back-End Code Tests

These tests make sure that our backend methods work independently. Specifically, these tests focus on whether the API is up, whether the site is up, and whether both status codes are properly implemented. We use Python's unittest framework to run these code tests. The framework is specially designed for running given tests independently and efficiently. Our front-end code tests can be accessed through the backend/tests.py symbolic link.

API Tests

Our final set of tests ensure that our API endpoints return the expected data and error codes. For each endpoint, our Postman API tests ensure that the correct data from our database is returned. For example, we can use these tests to ensure that when we pull from our API state endpoint using "AL" (Alabama) as our parameter, the endpoint will return a JSON-formatted piece of text with Alabama's FIPS code number, USPS abbreviation, full state name, and list of districts. Our Postman tests can be accessed through thePostman.json file in the project home directory.

Mobile Friendly

One final stress test we subjected our website to was a mobile-friendliness tool created by Google. The tool takes a website as input and reveals whether or not the website works well on mobile devices. As mobile devices become more prevalent, and as more and more people surf the web using their phone or tablet, it will be crucial for any widely-used site to work well on mobile. Though the tool has difficulty loading some Twitter assets because of Twitter's restrictions on what may be loaded, we are proud that our site has been certified mobile friendly.

results matching ""

    No results matching ""