I've a batch class in which I pass query as well as few parameters in its constuctor, like:
bclass1 b1 = new bclass1(query1, 'x') ;
bclass1 b2 = new bclass1(query2, 'y ') ;
bclass1 b3 = new bclass1(query2, 'z ') ;
Batch class execution depends on parameters like 'x', 'y' and 'z';
Now when i test it, I use similar logic with multiple execution in single method, like this :
Test.startTest();
bclass1 b1 = new bclass1(query1, 'x') ;
bclass1 b2 = new bclass1(query2, 'y ') ;
bclass1 b3 = new bclass1(query2, 'z ') ;
Database.executeBatch(b1);
Database.executeBatch(b2);
Database.executeBatch(b3);
Test.stopTest();
Now my questions are :
- Does that mean, executions of 3 batch job will start altogether in test class ?
- Would it be better, if I do execution of each Database.execute in separate test method of its own or doing this in current way wouldn't cause any issue?