Auth0 Home Blog Docs

How to write unit tests for rules

auth0
rules

#1

I have multiple rules in my tenant and now I want to write unit tests for my rules just like https://github.com/auth0/rules/tree/master/test Now the issue is in the docs (https://auth0.com/docs/support/testing) it’s written that we can use https://www.npmjs.com/package/auth0-rules-testharness module for unit test our rules but I think the explanation is old and it’s not updated because in the sample project (https://github.com/tawawa/auth0-rules-testharness-sample) we need to add webtask token and sandbox url and now we can’t find webtask token in Auth0 dashboard (https://manage.auth0.com/#/account/webtasks) and also where can I get this sandbox url? Any help?


#3

Hey there @jah!

You’re right the readme file in the sample repo seems outdated. I’ve submitted an issue so that it can be updated. Using your Auth0 sandbox for creating custom webtasks is a deprecated feature. You can, however, create a free account at https://webtask.io and from that page you should be able to follow the instructions for creating your test harness as a webtask there (webtask token + sandbox url).

Let me know if that helps!


#4

Hi,
Thanks for your response. Can you give the instructions page link on webtask.io because when I created new account on webtask.io. i was just redirected to the dashboard and I couldn’t find any instructions page there


#5

Sure @jah!

This workshop content will give you a quick tour guide on webtasks and how to use them:

Hope it helps!