Skip to content

Tests for CLI #4

Closed
Closed

Description

@vlidholt

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.

Activity

  1. added
    test
    on May 24, 2021
  2. yahu1031 commented on Jul 16, 2022

    @yahu1031
    Contributor

    @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.

  3. yahu1031 commented on Aug 31, 2022

    @yahu1031
    Contributor

    @vlidholt The files are not being exported. So It is not a good practice to write the tests in the tests folder which is outside of the serverpod_cli.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    test

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions