The application reads input data from Source1 and Source2 and in the Result (JSON format ), populates a field success as True when both files are present, and success as False when atleast one file is not present.
It has methods such as readFromSource1 and readFromSource2 and processData, writeOutput. When writing unit test cases, I can implement methods like test_readFromSource1 and test_readFromSource2, test_processData and test_writeOutput.
This can be used to test individual methods which are parts of functionality but how to test the overall flow which is like in below scenarios :
Scenario 1: Put sample files in both sources.
Expected output : the success field in the JSON output should be True.
Scenario 2: Put file only in source1 and not in source2.
Expected output : the success field should be false.
I can test individual methods using test methods but is there way to test the entire flow of a particular scenario using a test case ?
Or do I have to test this manually only by running the program and checking the value of success field and then record these results for each scenario in say a word document.?
This (13-year-old!) post I just read today discusses the issue of what a Unit test is, and the advantages and disadvantages of writing Unit tests that are really more like functional or integration tests:
Monica Shiralkar wrote:
This can be used to test individual methods which are parts of functionality but how to test the overall flow which is like in below scenarios ...
Testing the "overall flow" is what we call Integration Testing.
And yes, with JUnit, I often write Integration Tests as though they were Unit tests. Although at that level, I not infrequently use mocking frameworks to substitute for units that are too complex or delicate to run directly. Including mocking cases where the unit would have failed but I want to see how the higher-level code handles the failure. Without sabotaging the actual "failing" unit just to test.
Bjoke: A "Bully Joke". A Statement or action made with malicious intent - unless challenged. At which point it magically transforms into "I was just funnin'" or "What's the matter, can't take a joke?"