Software testing Technology (III.)--UI testing using causality Diagram method

Source: Internet
Author: User

Target Program

Add two identical input boxes to the previous one

Introduction to How to use

    • Causality Diagram method

In introduction to software testing by Paul, the coverage criteria for software testing are divided into four categories, logical expressions,syntactic Descriptions,graphs,input Domain characterizations, as far as I can see, equivalence class partitioning belongs to input domain characterizations, control flow and data flow test belong to graphs, and causality diagram method belongs to logical Expressions It finds the cause (input condition) and the fruit (output or program state change) from the description of the program specification written in natural language, and can be converted to a decision table by causality diagram.

    • Steps
      list cause and effect
      draw a causal diagram
      judging form According to the cause and effect drawing
      If there are too many variables, you can simplify the decision table before you design the test case

Causes and results

Reason Number

Content

C1

The first input box is not entered

C2

The second input box is not entered

C3

The third input box is not entered

B1

The first input box entered an error

B2

The second input box entered an error

B3

The third input box entered an error

Result number

Output action

Demand

Ef1

An error message appears after the first input box

C1 or B1

Ef2

An error message appears after the second input box

C2 or B2

Ef3

An error message appears after the third input box

C3 or B3

Ef4

Show "Success"

Three input boxes are entered correctly

Causality diagram

Decision table


Number






Reason

C1

0

0

1

1

0

C2

0

0

0

1

0

C3

0

0

0

1

0

B1

0

0

0

0

1

B2

0

0

0

0

1

B3

0

1

0

0

1

Intermediate results

M1

0

0

1

1

1

M2

0

0

0

1

1

M3

0

1

0

1

1

M4

0

1

1

1

1

Results

Ef1

0

0

1

1

1

Ef2

0

0

0

1

1

Ef3

0

1

0

1

1

Ef4

1

0

0

0

0

Program code

Program code

Package Addtna;import Java.io.bufferedreader;import Java.io.bufferedwriter;import java.io.file;import Java.io.fileinputstream;import Java.io.filenotfoundexception;import Java.io.fileoutputstream;import Java.io.filereader;import Java.io.filewriter;import Java.io.ioexception;import Java.io.InputStreamReader;import Java.io.outputstreamwriter;import Java.io.printwriter;import Java.io.writer;import Java.net.URL;import Java.util.hashmap;import Java.util.iterator;import Java.util.regex.matcher;import Java.util.regex.Pattern;import Javafx.application.application;import Javafx.beans.value.changelistener;import Javafx.beans.value.observablevalue;import Javafx.event.actionevent;import Javafx.event.eventhandler;import Javafx.geometry.orientation;import Javafx.geometry.pos;import Javafx.scene.group;import Javafx.scene.Scene;import Javafx.scene.control.button;import Javafx.scene.control.label;import Javafx.scene.control.scrollbar;import Javafx.scene.control.textfield;import javafx.scene.layout.BackgRound;import Javafx.scene.layout.borderpane;import Javafx.scene.layout.hbox;import Javafx.scene.layout.StackPane; Import Javafx.scene.layout.tilepane;import Javafx.scene.layout.vbox;import Javafx.scene.paint.color;import Javafx.scene.text.font;import Javafx.scene.text.fontweight;import Javafx.scene.text.text;import Javafx.stage.stage;public class Copyofname extends application {public static void main (string[] args) {launch (args);} public void Start (Stage primarystage) {Group root = new Group (); Label Label1 = new Label ("Name:"); Label Label2 = new Label ("Name:"); Label label3 = new Label ("Name:"); TextField Name1 = new TextField (); TextField Name2 = new TextField (); TextField Name3 = new TextField (); Label label12 = new label ("Please enter 1-6 English letters or numbers"); Label label22 = new label ("Please enter 1-6 English letters or numbers"); Label label32 = new label ("Please enter 1-6 English letters or numbers"); label12.setopacity (0); label22.setopacity (0); label32.setopacity (0); Label12.settextfill (color.red); Label22.settextfill (color.red); Label32.settextfill (Color.RED); Name1.sEtmaxwidth (100); Name2.setmaxwidth (100); Name3.setmaxwidth (100); HBox hb1 = new HBox (); Hb1.getchildren (). Add (Label1); Hb1.getchildren (). Add (Name1); Hb1.getchildren (). Add (LABEL12); Hb1.setspacing (10); HBox HB2 = new HBox (); Hb2.getchildren (). Add (Label2); Hb2.getchildren (). Add (Name2); Hb2.getchildren (). Add (LABEL22); Hb2.setspacing (10); HBox HB3 = new HBox (); Hb3.getchildren (). Add (Label3); Hb3.getchildren (). Add (Name3); Hb3.getchildren (). Add (LABEL32); Hb3.setspacing (10); VBox vb = new VBox (); button confirm = New Button ("Confirm"); Vb.getchildren (). AddAll (HB1,HB2,HB3); Vb.getchildren (). Add (confirm); Vb.setspacing (VB.SETLAYOUTX); vb.setlayouty (+); Root.getstylesheets (). Add ("Ad.css"); File File = new file ("Xiaoshuo/ad.css"); System.out.println (File.exists ()); Confirm.setonaction (new EventHandler () {public void handle (ActionEvent arg0) {// TODO auto-generated method Stubborderpane al = new Borderpane (); Text T = new text ("Success"); StringBuffer S1 = new StringBuffer (Name1.gettext ()); StringBuffer s2 = new STRINGBUffer (Name2.gettext ()); StringBuffer s3 = new StringBuffer (Name3.gettext ()); System.out.println (S1); Pattern pattern = Pattern.compile ("[0-9a-za-z]+"); Boolean B1 = Pattern.matcher (S1). Matches (); Boolean b2 = Pattern.matcher (S2). Matches (); Boolean b3 = Pattern.matcher (S3). Matches (); if (!b1 | | s1.length () >=7) { Label12.setopacity (1);} Else{label12.setopacity (0);} if (!b2 | | s2.length () >=7) {label22.setopacity (1);} Else{label22.setopacity (0);} if (!b3 | | s3.length () >=7) {label32.setopacity (1);} Else{label32.setopacity (0);} Button back = New button ("Confirm"); Al.settop (t); Al.setalignment (T, pos.center); Al.setalignment (back, pos.center); Al.setcenter (back), Al.setlayoutx (Al.setlayouty), Root.getchildren (). Add (AL),//al.getstyleclass (). Add ("Ba "); vb.setopacity (0.3); Back.setonaction (new EventHandler () {@Overridepublic void handle (ActionEvent arg0) {//TODO Auto-generated method Stubroot.getchildren (). Remove (AL); Vb.setopacity (1.0);}}); Root.getchildren (). Add (VB); Scene scene = new Scene (Root, 400, 3XX);p rimarystage.setscene (Scene);p rimarystage.show ();}}

Software testing Technology (III.)--UI testing using causality Diagram method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.