The ERPNext docs on Custom Script is literally a bunch of examples and they don’t have anything I can refer to for my purpose.
I’m also aware of Python server-side scripting, but there’s no mention of that in the documentation.
Where can I get these information? It’s somewhat urgent so any response would be most welcome.
“Where can I get these information?”
Of course this is the place to search and inform yourself but please respect no @ tag even if this urgent.
“how to test scripts”
By definition custom scripts are the user’s own responsibility to test.
Ideally an automated test otherwise manual test!
Some breaking changes are to be expected since the code is evolving.
By how to test scripts, I meant debugging. I’d like to run the scripts while looking at the console or some sort log file for errors to find where I went wrong.
Yes of course you need to follow an experimental process of expected versus actual output results based on example data inputs.
To exercise and validate that your scripts are correct, first formulate your test suites of trial data.
Traceback errors in the client browser or server logs should be obvious. But test failures, where actual results are not the same as your expecteds, are not so obvious - for example numeric value asserts mismatch.
Custom scripts used in production must already have been validated, correct?
To write these tests in code often make perfect sense depending on your business case.
Speaking of example input and test data, does bench have method of instantiating test sites or is the most sane way is to take the SQL of production and instantiate a new ERPN with the said copy and then run tests on it? Manually inputting sample customer, supplier and item data doesn’t make sense and wouldn’e be good trial data to work with.
Browser consoles for JS scripts are obvious enough, but is
logs/bench.log the only place to look into them?
Start by reviewing the docs https://frappe.io/docs/user/en/guides/automated-testing/unit-testing.
The more you learn about the code the better - this forum is all about how to inform yourself and ways to contribute to this flourishing community.