2 answers
Hi Raghav Chaturvedi,Issue is coming because of below code in your Trigger.Pricebook2 prbook=[select id from Pricebook2 where isStandard=true and isActive=true];You need to create Pricebook2 record in your test class. Dnt use SeeAllData = true in your test class. Update your code like below
Let us know if this will help you@istest
public class TestSetpricebookentry1
{
@istest
public static void mytest()
{
Id pricebookId = Test.getStandardPricebookId();
Pricebook2 customPB = new Pricebook2(id=pricebookId , isActive=true);
update customPB ;
Product2 po=new Product2();
po.Name='Raghav';
po.IsActive=true;
insert po;
}
}