You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add tests for the command-line interface. In a first version add tests for:
serverpod create
serverpod generate
The tests need to be runnable locally but also be in continuous integration. The tests should be separate from the integration tests. Proposed solution:
Place the tests in tests/cli_tests
Make a shell (sh) script or Dart program that runs the tests. The program will run serverpod create test_create and place the results in tests/cli_tests/test_create directory. (If the directory exists prior to running serverpod create it needs to be deleted).
Make sure that the script runs a local version of the serverpod_cli (see documentation on contributing).
Remove all files generated by the flutter create command from the directory (e.g. macos/android/ios directories).
Compare the contents of the tests/cli_tests/test_create directory a previously saved tests/cli_tests/test_create_golden directory. If they match the test passes.
Make a similar test for serverpod generate with a tests/cli_tests/test_generate and a tests/cli_tests/test_generate_golden directory.
The tests/cli_tests/test_generate/test_generate_server should ideally contain a sample project with all supported types represented.
Before running serverpod generate remove all generated files from test_generate_server and test_generate_flutter.
@vlidholt I'm trying to write test cases. But I found that CLI has no lib folder and could not able to access the file in the tests folder in the root project. Please LMK if you have any idea. If not there is only one way we could do it. Writing the test cases in the serverpod_cli package itself.
Activity
yahu1031 commentedon Jul 16, 2022
@vlidholt I'm trying to write test cases. But I found that CLI has no
libfolder and could not able to access the file in thetestsfolder in the root project. Please LMK if you have any idea. If not there is only one way we could do it. Writing the test cases in theserverpod_clipackage itself.yahu1031 commentedon Aug 31, 2022
@vlidholt The files are not being exported. So It is not a good practice to write the tests in the
testsfolder which is outside of theserverpod_cli.