Skip to content

Test data

ootee edited this page Jun 29, 2018 · 43 revisions

Test data location

For database the seed files are located at /backend/server/seeders.
For fake-Kurki the response files are located at /Kurki_simulation/responses

Please note that the data in these two locations needs to match in order for the application to work properly.

Adding test data

Run migrations if there are changes to the db

$ npm run migrate

Add data

$ npm run add_test_data

Deleting test data

$ npm run delete_test_data

Initializing database

If you encounter problems when trying to add test data, you can drop and initialize the db. Remember to shut down the backend and disconnect the PGadmin4 server first. Please note that you can only do this locally and all changes to the database need to be done with migrations because you cannot drop the production database.

At backend folder:

$ npm run dropdb

$ npm run createdb

$ npm run migrate

$ npm run add_test_data

Test data users

Test data contains various users to use in different scenarios.
Username format for students is {course}opiskelija{n} where

  • for course = {tira, otm} n = {1, 2, 3, 4}
    {1, 2, 3} from each course have registered to the course at WebOodi.
    {1, 2} have already registered on Labtool and {1} has points from weeks and comments.
    {3} has not set an email address and has not registered on Labtool but should be able to.
    {4} has not registered to the course on WebOodi and should not be able to register on Labtool.

  • for course = {tsoha, tilpe} n = {1, 2}
    {1, 2} have registered on WebOodi but not yet on Labtool

User superopiskelija is registered to all imported courses and all WebOodi courses.
Users otmohjaaja1 - otmohjaaja10 are assistants on the course otm to test filtering by assistant.
Username format for assistant teacher is {course}ohjaaja where course = {tira, otm, tsoha, tilpe}.
User paaopettaja is admin and teacher for all courses.
User opettajaeinumeroa is defined at fake-Kurki and can be used to test importing a course.

Test data courses

Courses Aineopintojen harjoitustyö: Tietorakenteet ja algoritmit and Ohjelmistotekniikan menetelmät have been imported to Labtool, have registered users and have weekly points awarded.

Course Ohjelmistotekniikan menetelmät includes 200 random students with tag and assistant to test the functionality of the application with large courses.

Course Aineopintojen harjoitustyö: Tietokantasovellus has been imported to Labtool, but there are no registered Labtool users yet and the course is inactive.

Course Aineopintojen harjoitustyö: Tietoliikenne has not been imported yet, so it can be found from {backendurl}/admin.

Course Aineopintojen harjoituskurssi: Opettajalla ei opiskelijanumeroa is not imported yet and can be used to test importing a course from scratch.

Weeks, comments, codereviews, tags, checklists

Courses Tietorakenteet ja algoritmit and Ohjelmistotekniikan menetelmät have students named Maarit Mirja Opiskelija and Sanna Sofia Makkonen, respectively, who have reviewed weeks. Makkonen also has comments.

These courses also have some code reviews and tags assigned.

There is a checklist available for week 1 of Tietorakenteet ja algoritmit and Tietoliikenne.

Username cheatsheet

paaopettaja
tiraopiskelija1
...
tiraohjaaja
otmopiskelija1
...
otmohjaaja
tsohaopiskelija1
...
tsohaohjaaja
tilpeopiskelija1
...
tilpeohjaaja
superopiskelija
opettajaeinumeroa