---
schema_version: "1"
id: 9f28427c466287f93bae24f62a63799e13081df44d2ebe5fcecf9b69b397480f
title: Workflow to Test Your Components with Lightning Web Security
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/lwc/lightning-components-security/guides/lws/lws-test-workflow.md
canonical_url: https://developer.salesforce.com/docs/platform/lightning-components-security/guide/lws-test-workflow.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: f2c2a6bd014b9d669f82f3cc48b2adb2d35ef8e1eb53c0ae60e511690e226ad1
products:
  - Security for Lightning Components
  - lwc
---
# Workflow to Test Your Components with Lightning Web Security

To evaluate how your custom Lightning components run with Lightning Web Security (LWS) enabled, follow this workflow.

:::Important

You can’t disable LWS on individual components. If you refactor components to take advantage of [features only available with LWS enabled](https://developer.salesforce.com/docs/platform/lightning-components-security/get-started/get-started-compare-lws-locker.md), ensure that you thoroughly test all your components in sandboxes before you push them to production orgs. See [Considerations Before Using LWS-Only Features](https://developer.salesforce.com/docs/platform/lightning-components-security/guide/lws-refactor.md).

:::

1.  Download and configure the ESLint rules as described in [Install ESLint Rules for Lightning Web Security](https://developer.salesforce.com/docs/platform/lightning-components-security/guide/lws-tools-lint.md).
2.  Run the base rule set against your components as described in [Run Base Rules Against Your Project](https://developer.salesforce.com/docs/platform/lightning-components-security/guide/lws-tools-lint.md#run-base-rules-against-your-project).
3.  Fix any errors revealed by the base ESLint rules.
4.  As you fix the errors, try the revised code in the [Lightning Web Security Console](https://developer.salesforce.com/tools/lws-console) to see if it can run with LWS.
5.  If your code is affected by distortions, review the distortion descriptions in the [LWS Distortion Viewer](https://developer.salesforce.com/tools/lws-distortion-viewer) for help with understanding the issues.
6.  After you fix the linting errors, enable **Use Lightning Web Security for Lightning web components and Aura components** in a sandbox, as described in [Enable Lightning Web Security in an Org](https://developer.salesforce.com/docs/platform/lightning-components-security/guide/lws-enable.md).
7.  Deploy your components to the sandbox.
8.  Test your components manually and by running your automated tests.
9.  If you notice any abnormal behavior or test results, try running the `recommended` rule set on your component code to debug any additional issues. You can skip this step if you ran the code in Lightning Web Security Console. The tool runs both sets of ESLint rules.
10. If your component isn’t performing correctly with Lightning Web Security enabled, or you can’t fix the ESLint errors, you can discuss the issue in the [Lightning Components Development group](https://sfdc.co/NextGenWebSecurity) on Trailhead.

11. If wish to keep your components backwards compatible with [Lightning Locker](https://developer.salesforce.com/docs/platform/lightning-components-security/locker/locker-intro.md), follow these additional steps. For backwards compatibility with Lightning Locker, your components can’t use [features only available with LWS enabled](https://developer.salesforce.com/docs/platform/lightning-components-security/get-started/get-started-compare-lws-locker.md).
    1.  In the sandbox, Disable the **Use Lightning Web Security for Lightning web components and Aura components** setting.
    2.  To ensure that the correct files are loaded in the browser for Lightning Locker, clear the browser cache. If the results aren’t what you expect after clearing the cache, try the other cache-related solutions in [Delayed Enabling or Disabling of LWS](https://developer.salesforce.com/docs/platform/lightning-components-security/guide/lws-caching.md).
    3.  To evaluate whether your components still work with Lightning Locker, test the modified components in the sandbox org. Use the [Lightning Locker Console](https://developer.salesforce.com/tools/locker-service-console) and the [Locker API Viewer](https://developer.salesforce.com/tools/locker-service-viewer) tools.
12. If the modified components perform well and pass tests in the sandbox, deploy the changes to production.
13. Enable the **Use Lightning Web Security for Lightning web components and Aura components** setting in production.

**See Also**

- [Debug with Lightning Web Security Enabled](https://developer.salesforce.com/docs/platform/lightning-components-security/guide/lws-debug.md)
- [Troubleshoot Issues Related to Lightning Web Security](https://developer.salesforce.com/docs/platform/lightning-components-security/guide/lws-troubleshoot.md)
- [_Lightning Web Components Developer Guide_: Debug Lightning Web Components](/docs/platform/lwc/guide/debug-intro.html)
- [_Lightning Aura Components Developer Guide_: Debugging](https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/debug_intro.htm)
