You need to sign in to do that
Don't have an account?
sfdc newbie
Error: variable industrty does not exist
Could any one help y iam getting error in my test class
@isTest
private class ChatterAnswersCreateAccountTest {
static testMethod void validateAccountCreation() {
Profile[] p = [SELECT Id FROM Profile WHERE UserType = 'Standard'];
User[] user = [SELECT Id, Firstname, Lastname FROM User WHERE IsActive = true and ProfileId =: p[0].Id];
// We cannot create account without a user.
if (user.size() == 0) { return; }
String firstName = user[0].FirstName;
String lastName = user[0].LastName;
String userId = user[0].Id;
String accountId = new ChatterAnswersRegistration().createAccount(firstName, lastName, Industry, userId);
Account account = [SELECT name, Industry, ownerId from Account where Id =: accountId];
System.assertEquals(firstName + ' ' + lastName, account.name, account.Industry);
System.assertEquals(userId, account.ownerId);
}
}
@isTest
private class ChatterAnswersCreateAccountTest {
static testMethod void validateAccountCreation() {
Profile[] p = [SELECT Id FROM Profile WHERE UserType = 'Standard'];
User[] user = [SELECT Id, Firstname, Lastname FROM User WHERE IsActive = true and ProfileId =: p[0].Id];
// We cannot create account without a user.
if (user.size() == 0) { return; }
String firstName = user[0].FirstName;
String lastName = user[0].LastName;
String userId = user[0].Id;
String accountId = new ChatterAnswersRegistration().createAccount(firstName, lastName, Industry, userId);
Account account = [SELECT name, Industry, ownerId from Account where Id =: accountId];
System.assertEquals(firstName + ' ' + lastName, account.name, account.Industry);
System.assertEquals(userId, account.ownerId);
}
}
Looks like it is hidden for some of the profiles.
Thanks,
N.J
Change you code to
If this helps you mark this as best answer.
Thanks,
N.J
Error: Compile Error: Method does not exist or incorrect signature: [ChatterAnswersRegistration].createAccount(String, String, String, String) at line 12 column 61
If you are trying to test account creation you can do
Thanks.
and added all required fields eventhough iam getting an error like
System.AssertException: Assertion Failed: Expected: TestAcc, Actual: TestAccc
at the line System.assertEquals('TestAcc', account.name);
and one more doubt System.assertEquals(userId, account.ownerId); is not required ?
Replace line no 14 with System.assertEquals('TestAccc', account.name);
You can add multiple Asser depending on your requirement.
Thanks.