Skip to main content
.NET 6.0+

Test Conditional Appearance Rules

  • 3 minutes to read

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

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.EF;
using System.ComponentModel.DataAnnotations;
// ...
public class MyPerson : BaseObject {
    public virtual string Name { get; set; }

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

    [Appearance("DisableSpouseName", Criteria = "!IsMarried", Enabled = false)]
    public virtual string SpouseName { get; set; }

// Make sure that you use options.UseChangeTrackingProxies() in your DbContext settings.


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