Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "SW Testing - part of a better Process CERN-BE-BI-SW Training Day M.Andersen."— 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(); 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 Output Input

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 1.You only do what is needed to test 2.You think in small modules to be tested

7 Test Driven Development 2 3.Makes code less coupled- thus reusable Improves quality and reduces bugs by: 1.Making you think in terms of purpose and specs. 2.Simple≠ Complexity↔Bugs 3.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: 1.“..quality increased linearly with the number of programmer tests...” 2.“..test-first students on average wrote more tests 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 Regression Test Acceptance Test Integration Test Load Test Good to be aware which one we are doing

10 Acceptance (Functional) Testing Requirements document Feature A description Feature B description Feature C description 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 Example Functional specifications example In some companies done by QA section and often outsourced

11 Unit Testing Individual components, 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 4 Step 3 assertTrue( d4.hashCode()== d5.hashCode() );

14 Testing GUI in Java Challenge: How to automate test 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 JFrame Window JPanel JMenuB ar Panel MenuBar getMenuBar() getPanel() JButton JLabel TextBox getText() getButton(“Set”) Button click() getSubMenu(“Op en”) MenuItem getTextBox() JMenu

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() Obj A Obj B Obj C

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


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

Similar presentations


Ads by Google