Skip to content

Conversation

jgebal
Copy link
Member

@jgebal jgebal commented Oct 23, 2019

Added ability to nest contexts in suites - Resolves #938
Added fix for invalid context name - Resolves #966

Changed approach for context naming - Resolves #1016

So now you can write tests like a Pro (see talk by Kevlin Henney)

create or replace package queue_spec as
  -- %suite(Queue Spec)
  
  -- %context(a_not_empty_queue)
    
    -- %context(that_is_not_full)
      -- %test
      procedure becomes_longer_when_non_null_value_enqueued;
      -- %test
      procedure becomes_full_when_enqueued_up_to_capacity;
    -- %endcontext
    
    -- %context(that_is_full)
      -- %test
      procedure ignores_further_enqueued_values;
      -- %test
      procedure becomes_non_full_when_dequeued;
    -- %endcontext

    -- %test
    procedure dequeues_values_in_order_enqueued;

  -- %endcontext
end;

Leading to

Queue Spec
  a_not_empty_queue
    that_is_not_full
      becomes_longer_when_non_null_value_enqueued [SUCCESS]
      becomes_full_when_enqueued_up_to_capacity [SUCCESS]
    that_is_full
      ignores_further_enqueued_values [SUCCESS]
      becomes_non_full_when_dequeued [SUCCESS]
    dequeues_values_in_order_enqueued [SUCCESS]

TODO - review & update documentation & examples.
@jgebal jgebal added this to the 3.1.9 milestone Oct 23, 2019
…text

# Conflicts:
#	test/ut3_tester/core/test_suite_builder.pkb
#	test/ut3_tester/core/test_suite_builder.pks
Added validation of context name.
@jgebal jgebal requested review from lwasylow and pesse October 23, 2019 23:10
@jgebal
Copy link
Member Author

jgebal commented Oct 23, 2019

@pesse, @lwasylow, @Pazus - I'd like to get your feedback on my doubts around:
--%context(name) vs --%context(description) on SLACK before merging/altering this PR.

Changed behavior of ``--%context` annotation. The value f annotation now only indicates the context description.
Resolves #1016
@jgebal
Copy link
Member Author

jgebal commented Oct 28, 2019

@pesse, @lwasylow - the PR is ready for review.
I would definitely appreciate review of documentation changes.

@lwasylow
Copy link
Member

I see that it's implemented but I think that nested context is misuse. I think it should be replaced by nested suites and context should be not nested and exists within a suite. I will look into code 👍

@jgebal
Copy link
Member Author

jgebal commented Oct 31, 2019

I was of the same opinion from the moment we originally discussed contexts.
But users want it and there are situations where it is actually useful.

@jgebal jgebal merged commit 7740ec2 into develop Nov 1, 2019
@jgebal jgebal deleted the feature/nested_context branch November 5, 2019 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants