prashanth-sams/testrail-rspec

Use full_description instead of description to capture tags on context blocks

ErikDahlinghaus opened this issue · 1 comments

We are using shared_examples blocks which are difficult to tag because if we tag the inner examples, they will be marked multiple times and potentially on the wrong cases.

I think using full_description instead of description at update-testrails.rb#L25 will fix this issue because it will capture the tags on surrounding context blocks.

For example, given a set of TestRail cases

  • C1232: A regular user can log in
  • C1233: A regular user can log out
  • C1234: An admin user can log in
  • C1235: An admin user can log out

This rspec file is difficult to tag correctly.

shared_examples 'log in / log out' do
  it 'logs in'
  it 'logs out'
end

describe 'basic user stuff' do
  context 'A regular user can' do
    include_examples 'log in / log out'
  end

  context 'An admin user can' do
    include_examples 'log in / log out'
  end
end

With a little refactoring and my proposed change

shared_examples 'log in' do
  it 'logs in'
end

shared_examples 'log out' do
  it 'logs out'
end

describe 'basic user stuff' do
  context 'A regular user can' do
    context 'C1232' do
      include_examples 'log in'
    end

    context 'C1233' do
      include_examples 'log out'
    end
  end

  context 'An admin user can' do
    context 'C1234' do
      include_examples 'log in'
    end

    context 'C1235' do
      include_examples 'log out'
    end
  end
end

we can capture all of the functionality in the right cases.

Awesomeness 👍