Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should Account unit test set an account name? #170

Closed
deckblad opened this issue May 15, 2015 · 4 comments
Closed

Should Account unit test set an account name? #170

deckblad opened this issue May 15, 2015 · 4 comments

Comments

@deckblad
Copy link

I'm hitting a unit test error on dlrs_AccountTest because I have a trigger method that assumes Account.Name will be set to a non-null string value.

For now I'll be fixing my method to handle that situation.

But, Account.Name is a required field, is it not? Shouldn't your unit test set a dummy value for that field?

@afawcett
Copy link
Collaborator

Unfortunately the tool is generic and does not know about the requirements of every object, standard or custom, the generated test really only needs the record to fire the before phase of its trigger, not for the record to insert, however in your case your trigger won't tolerate required fields not being entered (which are not enforced outside of the UI).

There is another open issue that speaks about my adding support to allow the rollup definition to contain some default dummy values that will be injected into the test to help with these scenarios.

So the answer is no, to this question, but yes to the tool helping support this use case better. I'll add another comment to issue 122 above.

@wes1278
Copy link
Contributor

wes1278 commented May 18, 2015

@afawcett, perhaps some of the work I did here could help with the autogeneration of test code for preparing records based on their required fields

@afawcett
Copy link
Collaborator

Yes that might add some intelligence to it i agree. For sure worth exploring this, as i don't want to make the tool anymore complicated for the end user if possible. But then i suspect even with some intelligence there will always be corner cases, so i think some raw mode to led devs modify the generated code (perhaps a field on the rollup) which avoids having to break out into dev tools and deployment etc is the ultimate fall back.

@afawcett
Copy link
Collaborator

Closing this, as i think the general issue is well covered in 122

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants