TITLE: ELECTRONIC CASH CONTROLLER SAMPLE CODE
CODE FOR LOGIN FORM: using System; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; namespace WindowsFormsApplication4 { public partial class login : Form { SqlConnection con = new SqlConnection("datasource=MICROSOFT;database=ecc; integrated security=true;"); public login() { InitializeComponent(); } Private void button1_Click(object sender, EventArgs e) {
Signup nu = new Signup(); [Link](); } private void button2_Click(object sender, EventArgs e) { if ([Link] != "" && [Link] != "") { try { SqlCommand cmd = new SqlCommand("select * from users Where username ='" + [Link] + "' and password ='" + [Link] + "'", con); [Link](); SqlDataReader dr = [Link](); if ([Link]()) { Home hp = new Home(); [Link](); } [Link](); } catch { [Link]("invalid login"); } } else { if ([Link] == "" && [Link] == "") [Link]("Please Enter Username and Password", "Error Message");
else { if ([Link] == "") [Link]("Please Enter Username", "Error Message"); if ([Link] == "") [Link]("Please Enter Password", "Error Message"); } } } } }
CODE FOR SIGNUP FORM: using System; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; namespace WindowsFormsApplication4 { public partial class Signup : Form { SqlConnection con = new SqlConnection("Data Source=MICROSOFT;database=ecc;integrated security=true;"); public Signup() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { if ([Link] == "" && [Link] == "" && [Link] == "") { [Link]("Enter all fields", "error message"); } if ([Link] != [Link]) {
[Link]("password and conform password must be same"); } if ([Link] != "" && [Link] != "" && [Link] != "") { try { SqlCommand cmd = new SqlCommand("insert into users values(@username,@password,@retypepassword)", con); [Link]("@username", [Link]); [Link]("@password", [Link]); [Link]("@retypepassword", [Link]); [Link](); [Link](); [Link](); [Link]("username created"); login lo = new login(); [Link](); } catch { [Link]("username allready exists"); } } } private void linkLabel1_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e) { } } } login lo = new login(); [Link]();
CODE FOR HOME FORM: using System; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; namespace WindowsFormsApplication4 { public partial class Home : Form { public Home() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { AddingItems ia=new AddingItems(); [Link](); } private void button2_Click(object sender, EventArgs e) { Billing ib = new Billing(); [Link](); } private void button3_Click(object sender, EventArgs e)
{ CashBalance ic = new CashBalance(); [Link](); } } }
CODE FOR ADDINGITEMS FORM: using System; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; namespace WindowsFormsApplication4 { public partial class AddingItems : Form { SqlConnection con = new SqlConnection("Data Source=MICROSOFT;database=ecc;integrated security=true;"); public AddingItems() { InitializeComponent(); } private void Form4_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the '[Link]' table. You can move, or remove it, as needed. [Link]([Link]); GetGrid(); } private void button1_Click(object sender, EventArgs e) {
SqlCommand cmd = new SqlCommand("insert into Items values(@ItemId,@ItemName,@ItemPrice)", con); [Link]("@ItemId", [Link]); [Link]("@ItemName", [Link]); [Link]("@ItemPrice", [Link]); [Link](); [Link](); [Link](); GetGrid(); [Link] = ""; [Link] = ""; [Link] = ""; } private void button2_Click(object sender, EventArgs e) { SqlCommand cmd = new SqlCommand("update Items set ItemPrice=@ItemPrice where ItemId=@ItemId", con); [Link]("@ItemPrice", [Link]([Link])); [Link]("@ItemId", [Link]); [Link](); [Link](); [Link]("item sucessfully Updated"); [Link](); GetGrid(); } private void button3_Click(object sender, EventArgs e) { string str = "delete from Items where ItemId=" + [Link] + ""; SqlCommand cmd2 = new SqlCommand(str, con); [Link](); [Link]();
[Link]("item sucessfully deleted"); [Link](); GetGrid(); [Link] = ""; [Link] = ""; [Link] = ""; } private void textBox1_Leave(object sender, EventArgs e) { if ([Link] != "" && [Link] == true) { SqlDataAdapter da = new SqlDataAdapter("select ItemName,ItemPrice from Items where ItemId=" + [Link], con); DataSet ds = new DataSet(); [Link](ds); [Link] = [Link][0]; [Link] = [Link][0].Rows[0][0].ToString(); [Link] = [Link][0].Rows[0][1].ToString(); } } private void GetGrid() { SqlDataAdapter da1 = new SqlDataAdapter("select * from Items", con); DataSet ds1 = new DataSet(); [Link](ds1); [Link] = [Link][0]; { } }} Home h = new Home(); [Link](); } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
CODE FOR BILLING ITEMS FORM: using System; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; namespace WindowsFormsApplication4 { public partial class Billing : Form { SqlConnection con = new SqlConnection("Data Source=MICROSOFT;database=ecc;Integrated Security=True"); public Billing() { InitializeComponent(); } private void Form8_Load(object sender, EventArgs e) { SqlDataReader dr = null; SqlCommand cmd=new SqlCommand("select * from Items"); [Link]=con; [Link](); dr=[Link](); while([Link]()) {
[Link](dr["ItemName"]); } [Link](); } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { string str; SqlCommand cmd = new SqlCommand(); str = "select * from Items where ItemName =" + "'" + [Link]() + "'"; [Link] = str; [Link] = con; SqlDataReader dr; [Link](); dr = [Link](); [Link](); [Link] = dr[2].ToString(); //[Link] = dr[2].ToString(); [Link](); } private void button1_Click(object sender, EventArgs e) { [Link]([Link] + "\t" + [Link] + "\t" + [Link] + "\t" + [Link]);} private void textBox2_Leave(object sender, EventArgs e) { [Link] = ([Link]([Link]) * [Link]([Link])).ToString(); // [Link] = [Link]([Link]) * [Link](); } private void textBox4_Leave(object sender, EventArgs e)
{ [Link] = ([Link]([Link]) - [Link]([Link])).ToString(); } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Home h = new Home(); [Link](); } private void button2_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection("data source=MICROSOFT;database=ecc;integrated security=true;"); SqlCommand cmd = new SqlCommand("insert into cash values(@date,@Receivedcash,@RemainingCash,@Totalcash)", con); [Link]("@date", [Link]()); [Link]("@Receivedcash", [Link]); [Link]("@RemainingCash", [Link]); [Link]("@Totalcash", [Link]); [Link](); [Link](); [Link](); } } }
CODE FOR CASHBALANCE FORM: using System; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; using [Link]; namespace WindowsFormsApplication4 { public partial class CashBalance : Form { public CashBalance() { InitializeComponent(); } private void Form6_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the '[Link]' table. You can move, or remove it, as needed. [Link]([Link]); } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Home h = new Home(); [Link](); }}}
TESTING
Testing is a process of executing a program with the indent of finding an error. Testing is a crucial element of software quality assurance and presents ultimate review of specification, design and coding. System Testing is an important phase. Testing represents an interesting anomaly for the software. Thus a series of testing are performed for the proposed system before the system is ready for user acceptance testing. A good test case is one that has a high probability of finding an as undiscovered error. A successful test is one that uncovers an as undiscovered error.
Testing Objectives:
Testing is a process of executing a program with the intent of finding an error A good test case is one that has a probability of finding an as yet undiscovered error A successful test is one that uncovers an undiscovered error
Testing Principles:
All tests should be traceable to end user requirements Tests should be planned long before testing begins Testing should begin on a small scale and progress towards testing in large Exhaustive testing is not possible To be most effective testing should be conducted by a independent third party
The primary objective for test case design is to derive a set of tests that has the highest livelihood for uncovering defects in software. To accomplish this objective two different categories of test case design techniques are used. They are 1 White box testing.
2 Black box testing.
White-box testing:
White box testing focus on the program control structure. Test cases are derived to ensure that all statements in the program have been executed at least once during testing and that all logical conditions have been executed.
Block-box testing:
Black box testing is designed to validate functional requirements without regard to the internal workings of a program. Black box testing mainly focuses on the information domain of the software, deriving test cases by partitioning input and output in a manner that provides through test coverage. Incorrect and missing functions, interface errors, errors in data structures, error in functional logic are the errors falling in this category.
Testing strategies:
A strategy for software testing must accommodate low-level tests that are necessary to verify that all small source code segment has been correctly implemented as well as high-level tests that validate major system functions against customer requirements.
Testing fundamentals:
Testing is a process of executing program with the intent of finding error. A good test case is one that has high probability of finding an undiscovered error. If testing is conducted successfully it uncovers the errors in the software. Testing cannot show the absence of defects, it can only show that software defects present.
Testing Information flow:
Information flow for testing flows the pattern. Two class of input provided to test the process. The software configuration includes a software requirements specification, a design specification and source code.
Test configuration includes test plan and test cases and test tools. Tests are conducted and all the results are evaluated. That is test results are compared with expected results. When erroneous data are uncovered, an error is implied and debugging commences.
Unit testing:
Unit testing is essential for the verification of the code produced during the coding phase and hence the goal is to test the internal logic of the modules. Using the detailed design description as a guide, important paths are tested to uncover errors with in the boundary of the modules. These tests were carried out during the programming stage itself. All units of Vienna SQL were successfully tested.
Integration testing:
Integration testing focuses on unit tested modules and build the program structure that is dictated by the design phase.
System testing:
System testing tests the integration of each module in the system. It also tests to find discrepancies between the system and its original objective, current specification and system documentation. The primary concern is the compatibility of individual modules. Entire system is working properly or not will be tested here, and specified path ODBC connection will correct or not, and giving output or not are tested here these verifications and validations are done by giving input values to the system and by comparing with implementing here. expected output. Top-down testing
Acceptance Testing:
This testing is done to verify the readiness of the system for the implementation. Acceptance testing begins when the system is complete. Its purpose is to provide the end user with the confidence that the system is ready for use. It involves planning and execution of functional tests, performance tests and stress tests in order to demonstrate that the implemented system satisfies its requirements.
Tools to special importance during acceptance testing include: Test coverage Analyzer records the control paths followed for each test case. Timing Analyzer also called a profiler, reports the time spent in various regions of the code are areas to concentrate on to improve system performance. Coding standards static analyzers and standard checkers are used to inspect code for deviations from standards and guidelines.
STRUCTURAL TESTING:
1>In the White box testing the designer can drive test cases that guarantee that all independent paths with in a module have been exercised at least once. 2>Exercise all logical decision on their true and false sides. 3>Exercise all loops at their boundaries and within their operational bounds. 4> Exercise internal data structures to ensure their validity. There are several methods used in White box testing in the software design. Statement coverage In this, each statement in a program is executed at least once. This is done Checking the program in debug mode and by verifying each statement. Branch coverage In this, each and every branch is tested whether the different branch conditions are true or false. It is stronger test criteria over statement coverage testing.
Condition coverage In this, each component of a condition of a composite conditional expression is given both true and false values. It is a stronger test criterion over branch coverage testing. Path coverage In this testing, all the linearly independent paths in the program are executed once. A linearly independent path is defined in terms of the control flow graph of a program. The control flow graph describes how the flow of control passes through the program
Data-flow based testing In this method, selects the test paths of a program according to the locations of the definitions and use of the different variables in the program. Data-flow based testing strategies ate useful for selected tested paths of a program containing nested if and loop statements. Mutation testing In this method software is first tested by the above methods after the initial testing. In the mutation testing few small changes to program at a time such as, changing a conditional operator or changing the type of variable each time the program is changed, is called a mutated program and the change affected is called mutant. Then it is tested if it gives an error, then the mutant is said to be dead, if it is working properly then the test data is enhanced to kill the mutant.
FUNCTIONAL TESTING:
The Black box testing focuses on the functional requirements of the software. That is for a winger the Black box testing will give the desired results for what it is meant for, it means that he has to exercise all the functional requirements for a program. The Black box testing is done after the software is developed. Black box testing attempts to find errors in the following 1> Incorrect or missing functions. 2> Interface errors 3> Errors in data structures or external database access. 4> Performance errors. 5> Initialization and termination errors.
Testing object orients programs are different from testing functional oriented programs. As the test cases in Black box testing are selected independently of the internal structure of the code, it does not matter whether the software is object oriented or function oriented however, if the testing is White box testing , then the test cases are determined on the basis of the structure of the program. Testing classes is fundamentally different from testing functions as a function has a clearly defined input-output behavior while a class does not have an input-output behavior specification. Further a class can not be tested directly, only an instance of it can be tested. This means that, we test a class indirectly by testing its instance. Further there is no sequential control flow with in a class like in functions.
In a function, arguments, passed to the function with global data determine the execution within the procedure, but in an object, the state associated with object also influences the path of the execution, and methods of a class can communicate each other among themselves through this state, because this state is persistent across invocation of methods. Hence, state of an object plays a major role in testing objects. System testing: System tests are designed to validate a fully developed system with a view to assuring that it meets requirements. There are three kinds of system testing: 1>Alpha testing Alpha testing refers to the system testing that it software carried out by the customer with in the organization along with the developer. The alpha tests are conducted in control manner. 2> Beta testing Beta testing is the system testing performed by a select group customers. The developer will not present at the site and the user will inform the problems that are encountered. As a result of problems reported during the beta test, the software developer makes the modifications and then prepares for release of the software to the customer. 3>Acceptance testing Acceptance testing is the system testing performed the customer to whether or not to accept the delivery of the system.
TEST CASES Test case for login page: Test case id LG01 Functional Enter test inthe username textbox LG02 Functional Enter test in textbox LG03 Graphical test Clicking login show next will the page P Valid customer the page The page next pass will shown the P the Check the password validity of will the password checked be pass the P Test name description P/N Expected result Actual result pass Pass/fail
Check the Username validity of will the username checked be
characters
characters password
will access be
next to the valid customer
to the valid customer LG04 Graphical test Password textbox P
Characters should
Characters
pass
be are
should encrypt the characters
encrypted in another form P New customer the
encrypted in another form New customer the pass
LG05
Functional Clicking test newuser button will show registration page to the new customer
will get the got page page
registration registration
Test case for signup page: Test case id LG01 Functional Enter test in textbox LG02 Functional Enter test in textbox LG03 Functional Clicking test create will show the next page to the new customer P New customer the page The page next pass will shown the P the Check the password validity of will the password checked be pass the P the Test name description P/N Expected result Actual result pass Pass/fail
Check the Username validity of will the username checked be
characters username
characters password
will access be
next to the valid customer
LG04
functional test
Password textbox
Characters Characters pass should be are same
should have same characters of confirm password textbox the the
same
else in
both
massage password and confirm password must be same will be shown
textboxes.
LG05
Functional Clicking test create without entering all the data will show a message
Message will shown enter fields
Message be shown enter all fields all
pass
Test case for home page: Test case id LG01 Functional Clicking test adding button will take the user to the additems page after checking the validity of the customer LG02 Functional Clicking billing P test button will take the user to the billing page after checking the validity of the customer P Check validity the customer the additems page Check validity the customer and the the page LG03 funtional test Clicking button cash P will Check validity the Valid of customer pass the Valid of customer can the see pass the Valid of customer can the page see pass Test name description P/N Expected result Actual result Pass/fail
and send to additem
send billing valid page billing
customer to
take the user to the balance cash page
the customer and the the cash balance page
can
see
the cash
send balance valid page his/her
after checking the validity of the customer
customer to
LG04 Graphical test
Images controls
and P used
New valid customer can
or Graphics pass are user friendly. easily
page is easily understandable by customer or not
understands thegraphics of page
Test case for adding items page: Test case id LG01 graphical test List of all P items should be shown listbox in Listbox should the Listbox has pass all the Test name description P/N Expected result Actual result Pass/fail
contain all items items details with itemname and itemprice details with itemid, itemid, itemname and itemprice
LG02
Functional Item test textbox can contain special
id N
It will show item item number id number shown
id pass
th message must be in must be in message is
characters
LG03
Functional Clicking test save button will save details new item the of
It will save Item detail pass the will the message is saved item is saved details and and show message new item is saved can
new item successfully successfully be seen
LG04
Functional Clicking test delete button will delete item an
item will be Item deleted with details deleted
is Pass
LG05
Functional Clicking test update button will save details old which modified the of item is
It update old detail
will Old an detail
item pass is
item modified and saved
Test case for billing items page: Test case id LG01 Functional Item name N test should accept special characters also LG02 Functional Number of N test item will accept the character Test name description P/N Expected result Actual result Pass/fail
It will show item name pass message as must be in item name characters must be in characters Message prompted
It will show number of pass a message items must in number of be items must integer be integer in message prompted. Customer the new item pass
LG03
Functional Clicking test add button will allow customer to add new items
Customer can new items
add added
LG04
functional
Listbox
Details
of Purchasing pass
test
will of
show
purchasing items item can be details seen on the occurred in page the listbox.
the details purchasing items LG05 Functional Clicking test ok button will terminate the customer billing P
the will for customer
User be and
can pass
transaction pay the bill terminated terminate the transaction
OUTPUTSCREENS: