Giter Club home page Giter Club logo

aiatncstatewebsite's Introduction

AI at NC State Website

A one-stop website to find all news, updates, and much more regarding the Artificial Intelligence Club at North Carolina State University.

Table of Contents

Development

Getting Started

Install Docker and Docker-Compose or make sure they are updated to the latest version if they are already installed. Build and start the development Docker containers with the following command:

docker compose up --build

If all works well, you should be able to create an admin account with:

docker compose run --rm backend python manage.py createsuperuser

Loading Development Database Fixtures

docker compose run --rm backend python manage.py loaddata dev-fixtures.json

Dumping Development Database Fixtures

docker compose run --rm backend python manage.py dumpdata --exclude=auth --exclude=contenttypes --exclude=admin --exclude=sessions --exclude=users -o dev-fixtures.json

Backend Testing

Running All Backend Tests

You can run all the backend unit tests at once with the following command:

docker compose run --rm backend coverage run manage.py test

There is also a helper script which runs all the unit tests which can be executed with the following command:

docker compose run --rm backend /test.sh

Additionally, if you would like to skip generating an HTML coverage report, you can do so by including the --no-html option (-nh for short) like so:

docker compose run --rm backend /test.sh --no-html

Running a Subset of Backend Tests

Every backend unit test should be decorated with the Django tag decorator to enable the running of smaller subsets tests that are common in some way. Tags should be defined as attributes of the Tags enumeration in the core.testcases module. The following is an example of tagging a test:

from core.testcases import Tags, VerboseTestCase

class ExampleTestCase(VerboseTestCase):
    @tag(Tags.MODEL)
    def test_model_example(self):
        self.fail('Not yet implemented.')

Following from this example, in order to only run units tests with the MODEL tag, you can run the following command:

docker compose run --rm backend python manage.py test --tag=model

Note that you use the enumeration member value 'model' rather than the name of the member MODEL. Also note that coverage cannot be used when running tests in this manner.

For more complex usage of Django tags (e.g., tagging a test with multiple tags, and excluding tests by tag when running tests) please refer to the official documentation.

Generating Test Coverage Reports

In order to view the test coverage breakdown of the most recent test execution, run the following command after doing a full run of all the tests:

docker compose run --rm backend coverage report

Alternatively, if you wish to view a more detailed breakdown of the test coverage report, you can generate an HTML version of the report which allows you to explore which lines of code were run, missed or excluded. First, run the following command:

docker compose run --rm backend coverage html

Then, open the generated index.html file in the backend/htmlcov directory with your preferred web browser.

Convenience Shell Script

There is a shell script included in the backend/scripts directory to make running all of the backend unit tests and generating an HTML coverage report more convenient. The script can be run with the following command:

docker compose run --rm backend /test.sh

You can also use the optional --no-html (shorthand -nh) command-line argument if you want to skip generating an HTML coverage report. For example:

docker compose run --rm backend /test.sh -nh

Frontend Testing

TODO

aiatncstatewebsite's People

Contributors

epm0dev avatar vyathakavilocana avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.