The document discusses unit testing and automated testing. It defines various testing terminology like unit tests, integration tests, system tests, and regression tests. It emphasizes the importance of testing early and often to find bugs quickly, increase quality assurance, and improve code design for testability. Automating tests through continuous integration is recommended to efficiently run tests on new code commits and catch errors early. Test-driven development is introduced as a practice of writing tests before code to ensure all tests initially fail and the code is developed to pass the tests.
Unit Tests &Automated TestingLee Englestone presents..www.manchesterdeveloper.com
2.
AgendaTerminologyWhat, Why, HowAutomatingunit tests & testingAdvanced stuffTest driven development (TDD)Code coverageWhat we wont be coveringContinuous Integration (in any depth)
3.
Terminology (for thenext hour)Unit testTests a small bit of code (from code)Integration testTest after addition of codeSystem test / functional testTest for adherence to user requirements Regression testTest that fixing / adding code hasn’t introduced bugsContinuous integrationAutomated checkout, building and testing of code from source controlSource : Lee & Wikipedia
4.
Why should weTEST?Why should we test at all?££REMEMBERTesting is just one step in QA£££££
Why have unittests?Why have unit tests?Find bugs early / fast feedbackIncrease QAWhy not to have unit testsIncreases development time?CostOfWritingUnitTests < Sum(BugFixing)
What is aunit test?“..tests if individual units of source code are fit for use.”Should beSmallSpecific (only test 1 thing)Clear pass / fail criteria
11.
What does aunit test look like? Using NUnit.Framework;[TestFixture]public class CarTests{ [Test] public void Test_Car_Paint () { // ArrangeColor paint = Color.Red; Car car = new Car(); // Actcar.paint(Color.Red); // AssertAssert.AreEqual(car.Color, paint); } …}ArrangeActAssert
An example scenario{Code Example }ObjectsCarPropertiesColorColordouble Valuedouble FuelLeveldouble FuelCapacityFuelTypeEnumFuelTypeMethodsCar.Crush()Car.Paint(Color)Car.AddFuel(FuelTypeEnum, double)Car.VeryImportantMethod()
Testing Web UI(Selenium)What if we want to test the UI? Manual recording and runningCan export to NUnitExamples : Community Fund FormH1 checking**{ Code Example }
16.
Test driven development(TDD)Write your tests, even BEFORE your code!Make sure all tests initially failThen implement the code that the tests are testing(Encourages Designing for Testing)
Testing Terminology (Wikipedia)Unittest“..a programmer tests if individual units of source code are fit for use.”Integration test“..individual software modules are combined and tested as a group. It occurs after unit testing and before system testing.”System test / functional test“..testing conducted on a complete, integrated system to evaluate the system's compliance with its specified requirements. Regression test“..seeks to uncover software errors by partially retesting a modified program. The intent of regression testing is to assure that a bug fix has been successfully corrected .. , while providing a general assurance that no other errors were introduced in the process of fixing the original problem.”Continuous integrationAutomated checkout, building and testing of code from source controlSource : Wikipedia
Editor's Notes
#10 There are no silver bullets in development.Developers have are there disposal an arsenal tools, and they must be used in the right way to fit company processes