日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

《软件测试技术》课程第二周随笔

發(fā)布時間:2025/3/15 编程问答 17 豆豆
生活随笔 收集整理的這篇文章主要介紹了 《软件测试技术》课程第二周随笔 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

這次的博客內容為,舉例解釋等價類劃分。

?

1. 問題描述

EditBox

在文本輸入框內輸入文字,然后按確認鍵。

允許接收的文字為:1至6個英文字符或數(shù)字。

?

2.等價類劃分

?有效等價類編號無效等價類編號
包括的字符a-z,A-Z,0-91其他字符3
字符串長度1-6204
???大于65

?

3.測試用例

編號輸入覆蓋等價類預期輸出
Test1a1,2Accepted
Test2A1,2Accepted
Test301,2Accepted
Test4abAB011,2Accepted
Test5?4Please try again.
Test6abcdefg5Please try again.
Test7@3Please try again.
Test8a b3Please try again.
Test9ab_cd3Please try again.

?

4.代碼實現(xiàn)及結果樣例

使用C#編寫,具體代碼如下。

這是C#自動生成的,描述GUI的Form1.Designer.cs的代碼:

namespace csharptest {partial class Form1{/// <summary>/// 必需的設計器變量。/// </summary>private System.ComponentModel.IContainer components = null;/// <summary>/// 清理所有正在使用的資源。/// </summary>/// <param name="disposing">如果應釋放托管資源,為 true;否則為 false。</param>protected override void Dispose(bool disposing){if (disposing && (components != null)){components.Dispose();}base.Dispose(disposing);}#region Windows 窗體設計器生成的代碼/// <summary>/// 設計器支持所需的方法 - 不要/// 使用代碼編輯器修改此方法的內容。/// </summary>private void InitializeComponent(){this.textBox1 = new System.Windows.Forms.TextBox();this.label1 = new System.Windows.Forms.Label();this.button1 = new System.Windows.Forms.Button();this.SuspendLayout();// // textBox1// this.textBox1.Location = new System.Drawing.Point(24, 49);this.textBox1.Name = "textBox1";this.textBox1.Size = new System.Drawing.Size(185, 21);this.textBox1.TabIndex = 0;// // label1// this.label1.AutoSize = true;this.label1.Location = new System.Drawing.Point(51, 19);this.label1.Name = "label1";this.label1.Size = new System.Drawing.Size(131, 12);this.label1.TabIndex = 1;this.label1.Text = "請輸入0~6個字母或數(shù)字";// // button1// this.button1.Location = new System.Drawing.Point(72, 85);this.button1.Name = "button1";this.button1.Size = new System.Drawing.Size(75, 23);this.button1.TabIndex = 2;this.button1.Text = "確認";this.button1.UseVisualStyleBackColor = true;this.button1.Click += new System.EventHandler(this.button1_Click);// // Form1// this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;this.ClientSize = new System.Drawing.Size(227, 124);this.Controls.Add(this.button1);this.Controls.Add(this.label1);this.Controls.Add(this.textBox1);this.Name = "Form1";this.Text = "EditBox";this.ResumeLayout(false);this.PerformLayout();}#endregionprivate System.Windows.Forms.TextBox textBox1;private System.Windows.Forms.Label label1;private System.Windows.Forms.Button button1;} }

這是其他代碼,有關于判斷字符串是否合法的部分,文件名為Form1.cs:

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;namespace csharptest {public partial class Form1 : Form{public Form1(){InitializeComponent();}private bool check(String text){if (text.Length <= 0) return false;if (text.Length > 6) return false;for (int i = 0; i < text.Length; i++){char c = text[i];if ((c < 'a' || c > 'z') && (c < 'A' || c > 'Z') && (c < '0' || c > '9'))return false;}return true;}private void button1_Click(object sender, EventArgs e){if (check(textBox1.Text))MessageBox.Show("Accepted");elseMessageBox.Show("Please try again.");}} }

測試用例結果圖:

測試編號EditBox返回結果
Test1
Test2
Test3
Test4
Test5
Test6
Test7
Test8
Test9

?

?

轉載于:https://www.cnblogs.com/jinzhao1994/p/4357851.html

總結

以上是生活随笔為你收集整理的《软件测试技术》课程第二周随笔的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。