A method can have multiple SilkPerformer.TestAttribute attributes applied to it. Attributes are not scripted, but created as project attributes. This makes it easier for engineers to customize BDL scripts to change values for different attributes, as all attributes can be found in the project attributes dialog box. Therefore the .NET test driver can access attributes with Bdl.AttributeGet.
The TestAttribute attribute has two parameters. The first parameter is the name of the attribute and the second is the default value of the project attribute.
A comment is scripted prior to the function call to indicate what specific attributes the function call requires.
// Requires attribute "Attrib1" with the default value: "Value1" DotNetCallMethod(hVuser1, "TMain");
C# Code | BDL Script |
---|---|
[Transaction(Etranstype.TRANSTYPE_MAIN)] [TestAttribute("Attrib1","Value1")] public void TMain() { string s = Bdl.AttributeGet("Attrib1"); } |
dcltrans transaction TMain begin // Requires attribute "Attrib1" // with the default value: "Value1" DotNetCallMethod(hVuser1,"TMain"); end; |
By customizing the attribute value in the project attributes dialog box, you can customize the runtime behavior of the .NET test driver without changing the .NET code.