1 / 23

SW Testing - part of a better Process

SW Testing - part of a better Process. CERN-BE-BI-SW Training Day M.Andersen. Testing late vs. early. Why is software late & buggy?. 1. Rushed timetables ->Hope is lost  2. Lousy design -> Hope is there  3. Inadequate testing -> Hope is there  Jack Ganslle – Embedded SW Guru

artie
Download Presentation

SW Testing - part of a better Process

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SW Testing -part of a better Process CERN-BE-BI-SW Training Day M.Andersen

  2. Testing late vs. early

  3. Why is software late & buggy? 1. Rushed timetables ->Hope is lost  2. Lousy design -> Hope is there  3. Inadequate testing -> Hope is there  Jack Ganslle – Embedded SW Guru Unlike HW which still can break under load, a tested SW stays always perfect!

  4. How do we test? cout<<“value=”<val<<endl; System.out.println(“value=”+val); Main() { MyNewClass a = new MyNewClass(); a.doMethod(); a.doMethod(); cout<< a.data()<<endl; }

  5. When to test? • When left to the end of the project, which is running late... testing is the last thing on your mind. • Final functional testing only covers 20% of the code! • Only 20% is new code writing so you won’t escape, 80% is bugfixing and testing anyway! • XP: Write software tests software, before or at least at the same time with coding features Input Output

  6. Test Driven Development 1 • Writing tests clarifies the purpose of the code. • Goes in hand with specs • Reduces time in rework • Less time spent debugging • Code simplification • You only do what is needed to test • You think in smallmodules to be tested

  7. Test Driven Development 2 • Makes code less coupled- thus reusable Improves quality and reduces bugs by: • Making you think in terms of purpose and specs. • Simple≠ Complexity↔Bugs • Maintainable http://agilepainrelief.com/notesfromatooluser/2008/10/advantages-of-tdd.html

  8. Does it work? •  "measuring a over 20 projects: if you have a large number of unit tests your code will be an order of magnitude (x10) less complex.“ • Controlled study results: • “..quality increased linearly with the number of programmer tests...” • “..test-first students on average wrote moretests and, in turn, students who wrote more tests tended to be more productive...” http://agilepainrelief.com/notesfromatooluser/2008/11/misconceptions-with-test-driven-development.html http://collaboration.csc.ncsu.edu/laurie/Papers/TDDpaperv8.pdf

  9. Types of SW test Unit Test Functional Test Integration Test Load Test Regression Test Acceptance Test Good to be aware which one we are doing

  10. Acceptance (Functional) Testing Acceptance Test document Test Feature A: test case a test case b Test Feature B test case d test case e test case f Test Feature C test case h Requirements document Feature A description Feature B description Feature C description In some companies done by QA section and often outsourced Example Functional specifications example

  11. Unit Testing • Individualcomponents, modules, classes not the final application. • Independent of context • Makes you think and design modular code • Requires extra code • Easy in Java & Eclipse using JUnit

  12. JUnit Step 1 Step 2

  13. JUnit Step 3 assertTrue( d4.hashCode()== d5.hashCode() ); Step 4

  14. Testing GUI in Java Challenge: How to automatetest for a GUI? • You need human to press buttons.. • You need human to read out fields, graphs..

  15. UISpec4J framework • .jar library to put in a class pass. • Uses JUnit • Offers a large set of wrappers for Java Swing graphical components • Allows users to write Unit and Full system tests for Panels or whole GUI Apps

  16. UISpec4J mechanism Button getButton(“Set”) Panel JButton getText() TextBox JPanel JLabel getTextBox() Window MenuBar getPanel() MenuItem JFrame JMenuBar JMenu click() getSubMenu(“Open”) getMenuBar()

  17. UISpec4J Code

  18. Integration Testing with Bamboo • Build server runs on cs-ccr-builds (BE-CO) • Java projects are rebuild with their dependencies • Executes Java JUnit tests at 2:00 at night • Provides a detailed status report from the test runs. • Sends an email with report on success or fail. • http://builds.cern.ch/browse/LHCFB-OFSUTESTS

  19. Example: OFSU test on Bamboo

  20. C++ testing • BE-CO Fesa team started using Google test framework • Profound experience. Direct quote: “ ..The problem with testing is that you discover how bad your code is!...” • You see bugs in code you thought was OK • You see bad design & architecture (tight coupled vs. Loose coupled code, complex dependencies...)

  21. Google Test

  22. C++ Testable code 1000+ lines of code inside RT action Small loosely coupled objects invoked from RT action Execute() Execute() Obj A Obj B Obj C

  23. References • http://collaboration.csc.ncsu.edu/laurie/Papers/TDDpaperv8.pdf • http://www.uispec4j.org/getting-started • http://www.vogella.de/articles/JUnit/article.html • http://www.softwaretestinghelp.com/types-of-software-testing/ • http://searchsoftwarequality.techtarget.com/resources/Software-Testing-Best-Practices • http://www.robthefiddler.com/java/using-uispec4j/ • http://java.sun.com/developer/Books/javaprogramming/ant/ant_chap04.pdf

More Related