iilyak opened a new pull request #2039: Exunit simplified
URL: https://github.com/apache/couchdb/pull/2039
 
 
   ## Overview
   
   Eunit testing framework has a number of deficiencies especially in the cases 
when mocking is involved. This PR introduces Elixir based ExUnit into our 
testing stack. The PR doesn't include tests themselves. The tests would be 
included in separate PRs.
   
   ## Testing recommendations
   
   Create `src/couch/test/exunit/crud_test.exs` with following content
   ```
   defmodule Couch.Test.CRUD do
     use Couch.Test.ExUnit.Case
     alias Couch.Test.Utils
   
     alias Couch.Test.Setup
   
     alias Couch.Test.Setup.Step
   
     def with_db(context, setup) do
       setup =
         setup
         |> Setup.Common.httpd_with_db()
         |> Setup.run()
   
       context =
         Map.merge(context, %{
           db_name: setup |> Setup.get(:db) |> Step.Create.DB.name(),
           base_url: setup |> Setup.get(:start) |> Step.Start.clustered_url(),
           user: setup |> Setup.get(:admin) |> Step.User.name()
         })
   
       {context, setup}
     end
   
     describe "Database CRUD using Fabric API" do
       @describetag setup: &__MODULE__.with_db/2
       test "Create DB", ctx do
         IO.puts("base_url: #{ctx.base_url}")
         IO.puts("admin: #{ctx.user}")
         IO.puts("db_name: #{ctx.db_name}")
       end
     end
   end
   ```
   Create `src/couch/test/exunit/test_helper.exs` with the following content:
   ```
   ExUnit.configure(formatters: [JUnitFormatter, ExUnit.CLIFormatter])
   ExUnit.start()`
   ```
   
   ## Related Issues or Pull Requests
   
   - old PR https://github.com/apache/couchdb/pull/2036 (the current PR is 
simplified by removing notion of testing adapter)
   
   ## Checklist
   
   - [x] Code is written and works correctly;
   - [ ] Changes are covered by tests;
   - [ ] Documentation reflects the changes;
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to