What are unit testing and integration testing, and what other types of testing should I know about?

后端 未结 9 2199
感动是毒
感动是毒 2020-12-22 22:42

I\'ve seen other people mention several types of testing on Stack Overflow.

The ones I can recall are unit testing and integration testing. Especially unit testing i

9条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-22 23:01

    There are different levels of testing corresponding to what stage you are at in the software development life cycle. The highest level is requirements analysis and the lowest level is implementation of the solution.

    What is unit testing?

    • Unit testing assesses the software in regards to its implementation.
    • We focus on testing units of a program (ie. individual methods) and disregard who calls/uses these units. Hence, we essentially treat each unit as a stand alone unit.
    • There are many unit testing tools, one of the most popular one is JUnit.

    • When performing unit testing we want to construct a test set (set of test cases) that satisfy a certain coverage criteria. This could be some structural coverage criteria (NC, EC, PPC etc.) or data flow criteria (ADC, AUC, ADUPC etc.)

    • Note that unit testing is the lowest level of testing because it assess the actual code units produced after implementation. This type of testing that is done before integration testing.
    • Efficient unit testing helps ensure that integration testing will not be painful, since it is cheaper and easier to spot and fix bugs when doing unit testing

    What is integration testing?

    • Integration testing is needed to ensure that our software still work when two or more components are combined.
    • You can perform integration testing before the system is complete.
    • The class integration test order (CITO) problem is associated with integration testing. CITO has to do with the strategy of integrating components. There are many proposed solutions to CITO such as top down integration, bottom up integration etc. The main goal is to integrate components in a way that enables efficient testing and the least amount of stubbing, since writing code stubs is not always easy and takes time. Note that this is still an active area of research!
    • Integration testing is done after unit testing.
    • It is often the case that the individual components work fine but when everything is put together, we suddenly see bugs appearing due to incompatibilities/issues with interfaces.

    Other levels of testing include:

    1. Regression Testing

      • This type of testing is given a lot of importance because developers commit changes to software quite often typically, so we want to make sure that these changes do not introduce bugs.
      • The key for effective regression testing is to limit the size of the regression tests so that it does not take too long to finish testing otherwise the test set will not finish running before the next commit. We must also pick effective test cases that will not miss bugs.
      • This type of testing should be automated.
      • It is important to note that we can always keep on adding more machines in order to counteract the increasing amount of regression tests but at some point the tradeoff is not worth it.
    2. Acceptance Testing

      • With this testing we assess software in relation to the provided requirements, basically we see if the software we have produced meets the requirements we were given.
      • This is usually the last type of testing done in the sequence of software development activities. In consequence this type of testing is done after unit testing and integration testing.

提交回复
热议问题