2

I am writing unit tests for BizTalk maps. I have this scenario- Map1 transforms input1 to output1. Map2 transforms output1 to output2.

To write unit test for Map2, I first need to make sure the first transformation is done and output1 is in place to be picked up by Map2 as input.

Should I use ordered tests to make sure first test is run before the second one? I guess this is not a good approach at all considering the fact of second test depending on a file generated by first test.

Or Should I test both maps in one single test method like this?

Or Should I use some sort of setup/teardown for the second test where the first map is executed using TestableMapBase on setup?

Any idea is appreciated.

Community
  • 1
  • 1
Thunderstruck
  • 335
  • 4
  • 15

1 Answers1

1

If you can't refactor the maps into a single map for some reason, the single test method is probably your best bet.

You could also write up a test method for the second map that uses "known good" output from the first map; of course, this will have to be updated if Map1 changes, but in that case you'd just want to use your combined test.

Dan Field
  • 20,885
  • 5
  • 55
  • 71