When jiffy generates the application, a set of automated tests are also generated for the application’s end-points. The tests make use of the standard go test tooling. Tests can be conducted using http or https, and run against the address:port that the application is presently serving on. Remember, the application must be running prior to executing the test.
The generated tests check the availability of the end-points and attempt to perform CRUD activities using representative data for the field-types. If customization has occurred in the model normalization and validation enhancement points, the field values used in the generated main_test.go file should be updated accordingly. The generated CRUD tests are provided as a starting point for your own testing.
The generated simple selector tests check the availability of the end-points, and attempt to perform a GET for each of the selection operators specified in the Entity->selectable field in the models.json file. It is not necessary to have values populated in the database in order for the simple selector tests to run.
At the moment, relationships are not included in the generated tests, and the test case generator needs to be updated to consider foreign-key relationships. For this reason, it is recommended to perform baseline model testing without foreign-keys in the model-files.
In order to conduct automated testing via a TLS connection, follow the instructions in the Testing with TLS section of this documentation to generate and install self-signed certificates. Next, open a terminal window and run go test as shown below:
go test -v -https -address "192.168.1.66:8080"
2018/06/05 17:50:17 package sqac init is running
using usr: {"email":"admin","password":"initpass"}
=== RUN TestCreatePerson
--- PASS: TestCreatePerson (0.03s)
=== RUN TestGetPersons
--- PASS: TestGetPersons (0.03s)
=== RUN TestGetPerson
--- PASS: TestGetPerson (0.01s)
=== RUN TestUpdatePerson
--- PASS: TestUpdatePerson (0.04s)
=== RUN TestDeletePerson
--- PASS: TestDeletePerson (0.01s)
=== RUN TestGetPersonsByName
--- PASS: TestGetPersonsByName (0.05s)
=== RUN TestGetPersonsByAge
--- PASS: TestGetPersonsByAge (0.09s)
=== RUN TestGetPersonsByWeight
--- PASS: TestGetPersonsByWeight (0.11s)
=== RUN TestGetPersonsByValidLicense
--- PASS: TestGetPersonsByValidLicense (0.10s)
PASS
ok exp/csrest4 1.495s
go test -v -address "192.168.1.66:8080"
2018/06/05 17:50:17 package sqac init is running
using usr: {"email":"admin","password":"initpass"}
=== RUN TestCreatePerson
--- PASS: TestCreatePerson (0.03s)
=== RUN TestGetPersons
--- PASS: TestGetPersons (0.03s)
=== RUN TestGetPerson
--- PASS: TestGetPerson (0.01s)
=== RUN TestUpdatePerson
--- PASS: TestUpdatePerson (0.04s)
=== RUN TestDeletePerson
--- PASS: TestDeletePerson (0.01s)
=== RUN TestGetPersonsByName
--- PASS: TestGetPersonsByName (0.05s)
=== RUN TestGetPersonsByAge
--- PASS: TestGetPersonsByAge (0.09s)
=== RUN TestGetPersonsByWeight
--- PASS: TestGetPersonsByWeight (0.11s)
=== RUN TestGetPersonsByValidLicense
--- PASS: TestGetPersonsByValidLicense (0.10s)
PASS
ok exp/csrest4 1.495s