Where is functional suite code located in our code base? How does our current functional suite currently handle populating data to DB?
Thanks -min On 11/27/12 5:22 PM, "Sudha Ponnaganti" <[email protected]> wrote: >Min, > >Does it make sense to add test cases to functional suite?? We have >extensive suite running now and it would help if you need to test DB and >functional aspects of APIs rather than testing code. > >Thanks >/Sudha > >-----Original Message----- >From: Min Chen [mailto:[email protected]] >Sent: Tuesday, November 27, 2012 5:17 PM >To: [email protected] >Subject: Re: [DISCUSS]How to write API Unit Tests > >The idea of not dependent on DB is nice, but I am not sure if this will >apply well to this particular LIST api performance refactor code I am >working on. In this case, the idea is to create Database view to remove >extra db trips in response generation to get various uuids. Without >talking to Database, feel that it is not testing the new code at all. And >by mocking all those manager classes (e.g. UserVmManagerImpl, etc), the >code path our api unit test case can cover will be only limited to that >one execute method in each api Command class. With such unit test cases, >I am afraid that we cannot be confident enough to say yes for the simple >question: Do the results returned by the api calls before and after the >changes are exactly same or not? > >Thanks >-min > >On 11/27/12 3:43 PM, "Animesh Chaturvedi" <[email protected]> >wrote: > >>Min >> >>I have few comments in-line. >> >>-----Original Message----- >>From: Min Chen [mailto:[email protected]] >>Sent: Tuesday, November 27, 2012 3:10 PM >>To: [email protected] >>Subject: [DISCUSS]How to write API Unit Tests >> >>Hi there, >> >> In working with API refactoring work, I cannot help wondering how we >>should write Junit test cases for our APIs. Recently I saw that Chip >>has merged some of his API unit test cases into master branch, and his >>api unit test cases are written using Mockito, so no DB and real MS are >>needed in running these Junit test cases. Here I want to raise this >>topic again to get some clarifications on api unit test guidelines: >> 1. Should we require API unit test cases to be able to run without DB >>existing or MS running? >>Animesh> Unit tests are meant to be run quickly and test only small >>portion of software independent of other things. In my opinion unit >>tests should not talk to database, communicate across network, require >>special environment changes like editing config files etc. >> 2. If answer is yes, then I guess that we just need to use Mockito to >>write our api unit test cases. >>Animesh> Yes using mock objects should be the way to go. Here is a >>classic paper on Unit testing with Mock Objects >>http://www.betgenius.com/mockobjects.pdf . >> >> 3. If answer is no, there are several follow-up questions to be >>clarified: >> 1) Does test case itself need to handle starting MS and stopping MS? >> 2) How should we set up a test DB? This may be needed for those >>list APIs. >> 3) Testcases need to handle tear down test data afterwards. >> >> Thanks >> -min >> >
