简体   繁体   English

如何在Fitnesse测试中传入空值?

[英]How do I pass in empty values in Fitnesse test?

I'm using Fit/Fitnesse. 我正在使用Fit / Fitnesse。 I have a column fixture that looks like this. 我有一个看起来像这样的列夹具。

!|Get Stepstools Medication Id From Vocab and String|  
|Concept As String|Vocabulary Name Abbr|Vocabulary Concept Id|Stepstools Med Id?|  
|AMOXICILLIN|RXNORM|723|1|  
|AMOXICILLIN| | |1|  
|AUGMENTIN|RXNORM|151392|8|  
|AUGMENTIN| | |8|  
|Amoxicillin 1000 MG / Clavulanate 62.5 MG Extended Release Tablet| | |8|

I'm trying to pass in empty string values by using | | 我试图通过使用| |传递空字符串值 | | but the test, when I run it, takes the value from the previous row and uses that instead. 但测试,当我运行它时,从前一行获取值并使用它。

My fixture code looks like this: 我的夹具代码如下所示:

public class GetStepstoolsMedicationIdFromVocabAndString: ColumnFixture
{
    public string VocabularyNameAbbr;
    public string VocabularyConceptId;
    public string ConceptAsString;

    public string StepStoolsMedId()
    {
        MedicationMapping mapping = MedicationMapper.GetStepMedIdFromVocabNameIdAndStringMed(
            VocabularyNameAbbr, 
            VocabularyConceptId, 
            ConceptAsString
            );

        if (mapping.SuccessfullyMapped)
        {
            return mapping.StepstoolsMedicationId.ToString();
        }
        else 
        {
            return mapping.ErrorMessage;
        }
    }
}

How do I get the test to use the empty string values? 如何让测试使用空字符串值?

I found it. 我找到了。 Instead of using just "||" 而不是只使用“||” or even "| |", Fitnesse expects the keyword "blank" if an empty string is the intent. 甚至“| |”,如果空字符串是意图,Fitnesse期望关键字“为空”。 So the revised test looks like this: 所以修改后的测试看起来像这样:

!|Get Stepstools Medication Id From Vocab and String| !|从词汇和字符串中获取Stepstools Medication Id |
|Concept As String|Vocabulary Name Abbr|Vocabulary Concept Id|Stepstools Med Id?| |作为字符串的概念|词汇名称缩写|词汇概念Id | Stepstools Med Id?|
|AMOXICILLIN|RXNORM|723|1| |阿莫西林| RXNORM | 723 | 1 |
|AMOXICILLIN|blank|blank|1| |阿莫西林|空白|空白| 1 |
|AUGMENTIN|RXNORM|151392|8| | AUGMENTIN | RXNORM | 151392 | 8 |
|AUGMENTIN|blank|blank|8| | AUGMENTIN |空白|空白| 8 |
|Amoxicillin 1000 MG / Clavulanate 62.5 MG Extended Release Tablet|blank|blank|8| |阿莫西林1000 MG /克拉维酸62.5 MG延长释放片|空白|空白| 8 |

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM