帮助硬编码用户名和密码进行测试 [英] Help With Hardcoding Username And Password For Testing

查看:63
本文介绍了帮助硬编码用户名和密码进行测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用硬编码的用户名和密码进行测试,但我不知道如何将它们放入我的代码中。例如,我希望我的用户名是mary,密码可以通过测试。


我认为它会是:txtPassword =" pass" txtUsername =" mary"


但这不起作用。


请帮忙..


这是我的代码:


< html xmlns =" http://www.w3.org/1999/xhtml" >

< head id =" Head1" runat =" server">

< title> BID< / title>

< / head>

< body>


< span style =" font-size:16pt; color:teal;">

< asp:Image ID =" Image1" RUNAT = QUOT;服务器"前景色= QUOT;银及QUOT;高度= QUOT; 128PX" ImageUrl ="〜/ IMAGES / wvdo_logo.gif"

Width =" 320px" />< br />

< br />

< br />

欢迎来到项目开发西弗吉尼亚州发展办公室。

< br />

< br />

请输入您的用户名和密码。< / span>


< form id =" Form1" RUNAT = QUOT;服务器">

< table style =" width:504px">

< tr>

< td style =" width: 111px;身高:28px">

< asp:标签ID =" lblUsername" RUNAT = QUOT;服务器"高度= QUOT; 24像素"宽度= QUOT; 104px"字体-粗体="真"前景色= QUOT;#8080FF" > USERNAME:< / asp:Label>& nbsp;

< / td>

< td style =" width:211px;高度:28px">

< asp:TextBox ID =" txtUsername" RUNAT = QUOT;服务器"宽度= QUOT; 136px" />

< asp:RequiredFieldValidator ID =" rfvUsername" RUNAT = QUOT;服务器" ErrorMessage ="请输入您的用户名"的ControlToValidate = QUOT; txtUsername"显示= QUOT;动态" Width =" 16px"> *< / asp:RequiredFieldValidator>< / td>

< td style =" width:211px;身高:28px">

< asp:RegularExpressionValidator ID =" revUsername" RUNAT = QUOT;服务器" ControlToValidate =" txtUsername"

Display =" Dynamic" ErrorMessage ="您的用户名无效>>< / asp:RegularExpressionValidator>< / td>

< / tr>


< tr>

< td style =" width:111px">

< asp:Label ID = QUOT; lblPassword" RUNAT = QUOT;服务器"字体-粗体="真"前景色= QUOT;#8080FF" Text =" PASSWORD:"

Width =" 104px">< / asp:Label>< / td>

< td style =" ;宽度:211px">

< asp:TextBox ID =" txtPassword" RUNAT = QUOT;服务器" Width =" 136px">< / asp:TextBox>

< asp:RequiredFieldValidator ID =" rfvPassword" RUNAT = QUOT;服务器" ControlToValidate =" txtPassword"

Display =" Dynamic" ErrorMessage =请输入您的密码 Width =" 16px"> *< / asp:RequiredFieldValidator>< / td>

< td style =" width:211px">

< asp:RegularExpressionValidator ID =" revPassword" RUNAT = QUOT;服务器" ControlToValidate =" txtPassword"

Display =" Dynamic" ErrorMessage =您的密码长度必须至少为4个字符

ValidationExpression =" \w {4,}">< / asp:RegularExpressionValidator>< / td>


< / table>

& nbsp;< br />

& nbsp; &安培; NBSP; & nbsp;& nbsp;< br />

< asp:Button ID =" btnSubmit" RUNAT = QUOT;服务器"字体-粗体="真"文本= [提交"一项PostBackUrl = QUOT;〜/ projectdevelopmentmain.aspx" />< br />

& nbsp; & nbsp;& nbsp;& nbsp;< br />

< asp:HyperLink ID =" hprMainMenu" RUNAT = QUOT;服务器"字体-粗体="真"宽度= QUOT; 88px" NavigateUrl ="〜/ mainpage.aspx">主菜单< / asp:HyperLink>< br />

< br />

< br />

< / form>

< / body>< / html>



谢谢!!!!

I am trying to test with a hard coded username and password and I do not know how to put them in my code. For example say I want my username to be mary and password to be pass for testing purposes.

I thought it would be : txtPassword = "pass" txtUsername = "mary"

but that doesn''t work.

help please..

Here is my code:

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>BID</title>
</head>
<body>


<span style="font-size: 16pt; color: teal;">
<asp:Image ID="Image1" runat="server" ForeColor="Silver" Height="128px" ImageUrl="~/IMAGES/wvdo_logo.gif"
Width="320px" /><br />
<br />
<br />
Welcome to the Project Development Department of the West Virginia Development Office.
<br />
<br />
Please enter your username and password.</span>

<form id="Form1" runat="server">
<table style="width: 504px">
<tr>
<td style="width: 111px; height: 28px">
<asp:Label ID="lblUsername" runat="server" Height="24px" Width="104px" Font-Bold="True" ForeColor="#8080FF" >USERNAME:</asp:Label>&nbsp;
</td>
<td style="width: 211px; height: 28px">
<asp:TextBox ID="txtUsername" runat="server" Width="136px" />
<asp:RequiredFieldValidator ID="rfvUsername" runat="server" ErrorMessage="Please enter your Username" ControlToValidate="txtUsername" Display="Dynamic" Width="16px">*</asp:RequiredFieldValidator></td>
<td style="width: 211px; height: 28px">
<asp:RegularExpressionValidator ID="revUsername" runat="server" ControlToValidate="txtUsername"
Display="Dynamic" ErrorMessage="Your Username is invalid"></asp:RegularExpressionValidator></td>
</tr>

<tr>
<td style="width: 111px">
<asp:Label ID="lblPassword" runat="server" Font-Bold="True" ForeColor="#8080FF" Text="PASSWORD:"
Width="104px"></asp:Label></td>
<td style="width: 211px">
<asp:TextBox ID="txtPassword" runat="server" Width="136px"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvPassword" runat="server" ControlToValidate="txtPassword"
Display="Dynamic" ErrorMessage="Please enter your password" Width="16px">*</asp:RequiredFieldValidator></td>
<td style="width: 211px">
<asp:RegularExpressionValidator ID="revPassword" runat="server" ControlToValidate="txtPassword"
Display="Dynamic" ErrorMessage="Your password must be at least 4 characters long"
ValidationExpression=" \w{4,}"></asp:RegularExpressionValidator></td>

</tr>
</table>
&nbsp;<br />
&nbsp; &nbsp; &nbsp;&nbsp;<br />
<asp:Button ID="btnSubmit" runat="server" Font-Bold="True" Text="Submit" PostBackUrl="~/projectdevelopmentmain.aspx" /><br />
&nbsp; &nbsp;&nbsp;&nbsp;<br />
<asp:HyperLink ID="hprMainMenu" runat="server" Font-Bold="True" Width="88px" NavigateUrl="~/mainpage.aspx">Main Menu</asp:HyperLink><br />
<br />
<br />
</form>
</body></html>


THANK YOU!!!!

推荐答案

您所拥有的位置:
Where you have:
展开 | 选择 | 换行 | 行号



你在哪里:
Where you have:
展开 | 选择 | Wrap | 行号


也许我键入了错误事情,我不是说硬编码就像它总是在那里我的意思是,这是它接受的用户名和密码。

我希望你理解。


谢谢
Maybe I typed the wrong thing, I don''t mean hard coded like it always being there I mean like that is the username and password it accepts.
I hope you understand.

thanks


这篇关于帮助硬编码用户名和密码进行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆