Skip to content

Commit

Permalink
#389: more keywords for TC/AR/ER
Browse files Browse the repository at this point in the history
Fixed #389
  • Loading branch information
dgroup committed Apr 30, 2021
1 parent 4c731bc commit 1e438a9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/lazylead/task/accuracy/testcase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,20 @@ def with_tc_ar_er?
# Detect index of line with test case
def detect_tc(line, index)
return unless @tc.negative?
@tc = index if eql? line,
%w[testcase: tc: teststeps: teststeps steps: tcsteps: tc testcases steps]
@tc = index if eql? line, %w[testcase: tc: teststeps: teststeps steps: tcsteps: tc testcases
steps usecase]
end

# Detect index of line with actual result
def detect_ar(line, index)
return unless @ar.negative? && index > @tc
@ar = index if starts? line, %w[ar: actualresult: ar= [ar]]
@ar = index if starts? line, %w[ar: actualresult: ar= [ar] actualresult]
end

# Detect index of line with expected result
def detect_er(line, index)
return unless @er.negative? && index > @tc
@er = index if starts? line, %w[er: expectedresult: er= [er]]
@er = index if starts? line, %w[er: expectedresult: er= [er] expectedresult]
end

def starts?(line, text)
Expand Down
18 changes: 18 additions & 0 deletions test/lazylead/task/accuracy/testcase_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,24 @@ class TestcaseTest < Lazylead::Test
*{color:#DE10AA}[AR]{color}* = YYYY"
end

test "TC named use case" do
assert testcase? "{color:#0747a6}+*Use case*+{color}
# Step 1
# Step ..
# Step N
*{color:#00673A}[ER]{color}* = XXXX
*{color:#DE10AA}[AR]{color}* = YYYY"
end

test "TC with full ar er words" do
assert testcase? "{color:#0747a6}+*Use case*+{color}
# Step 1
# Step ..
# Step N
*{color:#00673A}Expected result:{color}* = XXXX
*{color:#DE10AA}Actual Result:{color}* = YYYY"
end

# ensure that issue description has a test case, AR and ER
def testcase?(desc)
Testcase.new.passed(OpenStruct.new(description: desc))
Expand Down

0 comments on commit 1e438a9

Please sign in to comment.