I'm trying to run two different test classes, but every time I do this, one of them shows error on the setup method, right in the line where I'm going to insert a new user. Is there a way to fix this? I've checked the depuration logs after executing the tesst, but they don't show anything that could tell where the problem is.
This error during unit tests generally means that a specific record was locked in one test while another tried to use it. Use
@isTest(isParallel=false) on each class to force them to run in serial, or use different users (e.g. create a new user) for each test class. Note that these errors won't stop your deployments, as deployments always run tests in serial mode, not parallel mode.