+
Skip to content

@BeforeExample issues for 2nd and subsequent tests #262

Closed
@nigelcharman

Description

@nigelcharman

Reported by Vladimir100 to the Concordion google group.

We found a serious bug in Concordion 2.1.1 and 2.1.2 that prevents us from switching to the latest version. However, it works for 2.0.3.

Here is the md file.

## Sum and Divide Example

### [Example 1. 2 + 4](- "sum2-4")
The sum of two numbers [2] (- "#firstNumber")
   and  [4] (- "#secondNumber") will be [6] (- "?=getSum(#firstNumber, #secondNumber)").

### [Example 2. 4 / 2](- "divide4-2")  
Division of two numbers [4] (- "#firstNumber")
   and  [2] (- "#secondNumber") will be [2] (- "?=getQuotient(#firstNumber, #secondNumber)"). 

Here is the fixture.

@RunWith(ConcordionRunner.class)
public class AssertEq
{
 private String VBTest;
 
 @BeforeExample
 public void init()
 {
 VBTest = "Tony";
 }
 
 public int getSum(int a, int b)
 {
 System.out.println(VBTest);
 return a + b;
 }
 
 public int getQuotient(int a, int b )
 {
 System.out.println(VBTest);
 return a/b;
 }
}

Here is the outcome:

Tony

file:///var/folders/zp/74sv30dj3k5422sp02rcr6v00000gr/T/concordion/com/bluescape/VB/tests/AssertEq.html#sum2-4
Successes: 1, Failures: 0
null

file:///var/folders/zp/74sv30dj3k5422sp02rcr6v00000gr/T/concordion/com/bluescape/VB/tests/AssertEq.html#divide4-2
Successes: 1, Failures: 0

file:///var/folders/zp/74sv30dj3k5422sp02rcr6v00000gr/T/concordion/com/bluescape/VB/tests/AssertEq.html
Successes: 2, Failures: 0

As you can see, the variable VBTest is not initialized as "Tony" in the second example.
It is shown as null.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载