Skip to main content

Test Conditional Appearance Rules

  • 2 minutes to read

The EasyTest functional testing framework allows you to test Conditional Appearance rules. This topic demonstrates how to implement such tests.


A complete sample project is available in the DevExpress Code Examples database at

To see beginner’s step-by-step testing instructions, refer to the Test an Action topic.

Suppose you have the MyPerson persistent object that exposes the Name, IsMarried and SpouseName properties. The requirement is that the SpouseName property’s editor is disabled when IsMarried is false. To do this, apply the AppearanceAttribute to the SpouseName property:

using DevExpress.ExpressApp.ConditionalAppearance;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Xpo;
// ...
public class MyPerson : BaseObject {
    public MyPerson(Session session) : base(session) { }

    private string name;
    public string Name {
        get => name;
        set => SetPropertyValue(nameof(Name), ref name, value);

    private bool isMarried;
    public bool IsMarried {
        get => isMarried;
        set {
            SetPropertyValue(nameof(IsMarried), ref isMarried, value);
            if (!string.IsNullOrEmpty(SpouseName) && !value) SpouseName = string.Empty;

    private string spouseName;
    [Appearance("DisableSpouseName", Criteria = "!IsMarried", Enabled = false)]
    public string SpouseName {
        get => spouseName;
        set => SetPropertyValue(nameof(SpouseName), ref spouseName, value);


To test the MyPerson object’s Conditional Appearance rule, you can use the following EasyTest script.

;#DropDB MySolutionEasyTest

#Application MySolutionWin
#Application MySolutionWeb
#Application MySolutionBlazor

*Action Navigation(Person)

*Action New

;Set IsMarried to true
 Name = Jane Smith
 Is Married = true

;Test that the SpouseName field is editable
 Spouse Name = John Smith

;Set IsMarried to false
 Is Married = false

;Test that the SpouseName field is not editable
 Spouse Name = John Smith


EasyTest supports only test visibility and an enabled/disabled state.

See Also