PageReference
ApexPages
PageReference page = Page.Mypage;
Test.setCurrentPage(page);
page.getParameters().put('Action', 'View');
PageReference pg = Page.Mypage2;
pg.getParameters().put('Action', ApexPages.currentPage().getParameters().get('Action'));
ApexPages.currentPage().getParameters().get('Action') == 'View'
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, Label.ERR004));
page
<apex:page standardController="Object_c" action="{!getInfo}" extensions="Controller" showHeader="false" sidebar="false" standardStylesheets="false" >
apex
public Controller(ApexPages.StandardController sc){
sc.addFields(new List<String>{ 'Field1__c','Field2__c' });
obj= (Object_c)sc.getRecord();
}