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

Test code uses account and opportunity object--orgs may have validation rules in place #8

Closed
mshanemc opened this issue Nov 26, 2013 · 5 comments

Comments

@mshanemc
Copy link

I wasn't able to get the package to deploy--and those don't give much of a debug tail.

I got the raw from git and imported it and deployed it just as the source class/pages/etc.

The test code uses a trigger that is creating an opportunity. We had a validation rule that wouldn't allow the test opportunity to be inserted, which caused the rest of everything to fail.

I don't know how to get around the very likely possibility that target orgs have validation rules on such a common object. I didn't have this problem, but other orgs are likely to have val rules on account as well.

Proposed possibility: create 2 objects through the metadata api, put one as a lookup to the other, and then test the trigger deploy using those objects.

@afawcett
Copy link
Collaborator

Yeah this is a bit of a draw back, the test does have a try/catch in it to avoid it failing. But I guess the error you got was coverage? I suspect because the validation rules stopped even the 'before' phase of the trigger code firing. What I could do is offer a way to set fields on the test record to pass the validation rules, these would get generated into the test to ensure it passes. Would something like this help you?

@mshanemc
Copy link
Author

There were assets not succeeding... Because that opp wouldn't insert, then the asserts we're failing.

Meanwhile, even after adjusting the test data to meet our requirements, the deploy isn't happening. It works for a while like it is, the page says deployed, but still offers the option to deploy. Checking triggers, nothing deployed.

Is there a way to get the deployment logs? There must be something in there not working, either.

On Nov 30, 2013, at 2:39 PM, "Andrew Fawcett" <[email protected]mailto:[email protected]> wrote:

Yeah this is a bit of a draw back, the test does have a try/catch in it to avoid it failing. But I guess the error you got was coverage? I suspect because the validation rules stopped even the 'before' phase of the trigger code firing. What I could do is offer a way to set fields on the test record to pass the validation rules, these would get generated into the test to ensure it passes. Would something like this help you?


Reply to this email directly or view it on GitHubhttps://github.com//issues/8#issuecomment-29560509.

@afawcett
Copy link
Collaborator

I've managed to reproduce this, sorry for the long wait...looking at it now...

@afawcett
Copy link
Collaborator

Ok, the root issue was that it was not reporting test failures. Because the generated test has a try/catch in it, it will not cause failures, and will serve its purpose to obtain code coverage (since validation rules are invoked after the before phase of a trigger). So the remaining cause for deploy failure will be if other tests (excluded those from packages) are presently failing. It will now display these messages correctly, you can upgrade to v1.5 (see the link on the readme). Thanks for your patience, the trust is I'd been thinking this was a harder fix than it turned out to be! :)

@mshanemc
Copy link
Author

Been there, and totally understand. Glad to help!

On Dec 14, 2013, at 3:24 PM, "Andrew Fawcett" <[email protected]mailto:[email protected]> wrote:

Ok, the root issue was that it was not reporting test failures. Because the generated test has a try/catch in it, it will not cause failures, and will serve its purpose to obtain code coverage (since validation rules are invoked after the before phase of a trigger). So the remaining cause for deploy failure will be if other tests (excluded those from packages) are presently failing. It will now display these messages correctly, you can upgrade to v1.5 (see the link on the readme). Thanks for your patience, the trust is I'd been thinking this was a harder fix than it turned out to be! :)


Reply to this email directly or view it on GitHubhttps://github.com//issues/8#issuecomment-30589040.

afawcett pushed a commit that referenced this issue Nov 8, 2014
afawcett pushed a commit to afawcett/Salesforce-Lookup-Rollup-Summaries that referenced this issue Nov 8, 2014
This fix resolves an issue raised in DLRS and fixed in its copy of this
class.

SFDO-Community/declarative-lookup-rollup-summaries#8
3
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

2 participants