yuniql icon indicating copy to clipboard operation
yuniql copied to clipboard

Run all tests in one go

Open rdagumampan opened this issue 4 years ago • 2 comments

When testing new features or verifying the stability of the change, all tests in each supported platform must pass. Doing this today, we have to switch all the environment variables for each platform we are testing.

A more sustainable way is to run all these tests in one go. Such than we only need to issue dotnet test all tests are executed in all our supported platforms.

Running platform tests for SqlServer

  1. Always start by publishing Yuniql CLI (yuniql.exe) locally

    cd C:\play\yuniql\yuniql-cli
    dotnet build
    dotnet publish -c release -r win-x64 /p:publishsinglefile=true /p:publishtrimmed=true
    
  2. Configure your connection string

    SETX YUNIQL_TEST_TARGET_PLATFORM "sqlserver"
    SETX YUNIQL_TEST_CONNECTION_STRING "Server=localhost,1400;Database=yuniqldb;User Id=SA;Password=P@ssw0rd!"
    SETX YUNIQL_TEST_SAMPLEDB "C:\play\yuniql\samples\basic-sqlserver-sample"
    
    SETX YUNIQL_TEST_CLI "C:\play\yuniql\yuniql-cli\bin\release\netcoreapp3.0\win-x64\publish"
    SETX YUNIQL_TEST_HOST "LOCAL"
    

    You can also run the batch file setup_test_envs_sqlserver.bat register all these variables. The batch file is placed in yuniql-tests\platform-tests directory.

  3. Run the platform tests

    cd C:\play\yuniql\yuniql-tests\platform-tests
    dotnet build
    dotnet test -v n
    

Running platform tests for PostgreSql plugin

  1. Configure your connection string

    cd yuniql-platforms\postgresql
    dotnet publish -c release -r win-x64
    
    SETX YUNIQL_TEST_TARGET_PLATFORM "postgresql"
    SETX YUNIQL_TEST_CONNECTION_STRING "Host=localhost;Port=5432;Username=sa;Password=P@ssw0rd!;Database=yuniqldb"
    SETX YUNIQL_TEST_SAMPLEDB "C:\play\yuniql\samples\basic-postgresql-sample"
    
    SETX YUNIQL_TEST_CLI "C:\play\yuniql\yuniql-cli\bin\release\netcoreapp3.0\win-x64\publish"
    SETX YUNIQL_TEST_HOST "LOCAL"
    

    You can also run the batch file setup_test_envs_mysql.bat register all these variables. The batch file is placed in yuniql-tests\platform-tests directory.

  2. Run the platform tests

    cd C:\play\yuniql\yuniql-tests\platform-tests
    dotnet build
    dotnet test -v n
    

Running platform tests for MySql plugin

  1. Configure your connection string

    cd yuniql-platforms\mysql
    dotnet publish -c release -r win-x64
    
    SETX YUNIQL_TEST_TARGET_PLATFORM "mysql"
    SETX YUNIQL_TEST_CONNECTION_STRING "Server=localhost;Port=3306;Database=yuniqldb;Uid=root;Pwd=P@ssw0rd!;"
    SETX YUNIQL_TEST_SAMPLEDB "C:\play\yuniql\samples\basic-mysql-sample"
    
    SETX YUNIQL_TEST_CLI "C:\play\yuniql\yuniql-cli\bin\release\netcoreapp3.0\win-x64\publish"
    SETX YUNIQL_TEST_HOST "LOCAL"
    

    You can also run the batch file setup_test_envs_mysql.bat register all these variables. The batch file is placed in yuniql-tests\platform-tests directory.

  2. Run the platform tests

    cd C:\play\yuniql\yuniql-tests\platform-tests
    dotnet build
    dotnet test -v n
    

rdagumampan avatar May 02 '20 22:05 rdagumampan

Hi @rdagumampan Can I submit a PR for this issue ? We can plan a discussion about the process to launch unit test in one step

wcontayon avatar Nov 06 '20 22:11 wcontayon

You are very much welcome to submit a PR 👍 Thanks!

rdagumampan avatar Nov 08 '20 19:11 rdagumampan