lundi 29 août 2016

How to choose what type of Testing is suitable

Imagine I have multiple if-else flows in a function like below. I understand that using lot of if-else is not a good way to handle such situation.

private void processEvent (EventType event){
    if(event.eventType == "Test1"){
    //some process
    } else if(event.eventType == "Test1"){
    //some process
    } else if ...
}

I thought of using proper Unit test (TDD) and create this functionality, but still I'm confused how i should approach it

All types of flows are important where acceptance/functional tests for all event types are considered by domain experts.

processEvent is a function with multiple flows, where a developer would like to have multiple unit tests to cover all the flows in the function.

So which way should I go?

  1. Write functional tests for each type of event?

  2. Write unit tests for testing all flows in the function and write just one functional test to make sure that we have a functionality to process events ?

Aucun commentaire:

Enregistrer un commentaire