software testing programs

Upload: shuruki

Post on 02-Jun-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/11/2019 Software Testing Programs

    1/23

    S.NO CONTENT PG.NO

    1. SORTING OF ARRAYS

    2. STUDENT DETAILS

    3. PALINDROME

    4. STACK OPERATION

    5. QUEUE OPERATION

    6. SIMPLE VALIDATION IN JAVASCRIPT

    7. VALIDATION CONTROL IN ASP.NET

    8. EMAIL VALIDATION IN JAVASCRIPT

    . PROCESS TESTING ! FILE UPLOAD IN C" SCRIPT

    1#.FUNCTIONAL TESTING! DATA$ASE CONNECTION IN ASP.NET %

    V$ SCRIPT

  • 8/11/2019 Software Testing Programs

    2/23

    VALIDATION CONTROL IN ASP.NET

    &TML CODE !

    $L&'(&)* $al!aton

  • 8/11/2019 Software Testing Programs

    3/23

    C" CODE !

    pu+l partal lass 'e-ault : ,stem.8e+.&.PageA protete! o! 7utton1Cl;Bo+et sen!erD entrgs eE A

    La+el.(ext = "Four 6al &' s : " G (ext7ox1.(ext.(otrngBEH II

    OUTPUT!

  • 8/11/2019 Software Testing Programs

    4/23

    SIMPLE VALIDATION IN JAVASCRIPT

    &TML CODE !

    ?*ame : ?mal : ?6essage: Jn+spH

    K$C0&P( :-untonal!ate5ee!s5ormBE Aar-tn6al*ame = !oument.getlement7,&!Btxtmal*ameE.alueHar-tn6al6essage = !oument.getlement7,&!Btxtmal6essageE.alueHar-tn6al5rom = !oument.getlement7,&!Btxtmal5romE.alueH

    - B-tn6al*ame == ""E AalertB"Please enter the *ame"EH!oument.getlement7,&!Btxtmal*ameE.-ousBEHreturn -alseH I

    - B-tn6al5rom == ""E AalertB"Please enter the mal a!!ress"EH!oument.getlement7,&!Btxtmal5romE.-ousBEHreturn -alseH I- B-tn6al6essage == ""E AalertB"Please enter the message"EH!oument.getlement7,&!Btxtmal6essageE.-ousBEHreturn -alseH I

  • 8/11/2019 Software Testing Programs

    5/23

    !oument.-rmContats.su+mtBEHreturn trueHI

    OUTPUT !

  • 8/11/2019 Software Testing Programs

    6/23

    EMAIL VALIDATION IN JAVASCRIPT

    &TML CODE !

    ?mal :Jn+spHJn+spHJn+spH

    JAVASCRIPT !-untonal!atemalBargmalE Aaremal0egx = /[email protected]/H- Bargmal.mathBemal0egxEE Areturn true

    I else Areturn -alseH II-untonal!ate5ormBE Aar-tn6al5rom = !oument.getlement7,&!BtxtmalE.alueH

    - B-tn6al5rom == ""E AalertB"Please enter the mal a!!ress"EH!oument.getlement7,&!BtxtmalE.-ousBEHreturn -alseH I- B-tn6al5rom V= ""E A

    - BVal!atemalB-tn6al5romEE AalertB"Please enter a al! mal a!!ress"EH!oument.getlement7,&!BtxtmalE.-ousBEHreturn -alseH I I!oument.-rmContats.su+mtBEHreturn trueHI

  • 8/11/2019 Software Testing Programs

    7/23

    OUTPUT !

  • 8/11/2019 Software Testing Programs

    8/23

    PROCESS TESTING! FILE UPLOAD IN C" SCRIPT.

    &TML CODE !

    PL)' 5&L ploa! 5le

  • 8/11/2019 Software Testing Programs

    9/23

    OUTPUT!

  • 8/11/2019 Software Testing Programs

    10/23

    FUNCTIONAL TESTING! DATA$ASE CONNECTION IN ASP.NET % V$ SCRIPT

    V$ CODE !

    &mports ,stem.'ata.lClent&mports ,stem.'ata

    Partal Class 'e-ault &nherts ,stem.8e+.&.Page 'm n s *ew lConneton 'm s!a s *ew l'ata!apter 'm m! s *ew lComman! 'm str s trng 'm !s s *ew 'ataet

    u+ onnetBE (r, str = "&ntegrate! eurt,=P&HPersst eurt,&n-o=5alseH&ntal Catalog=masterH'ata oure=." n = *ew lConnetonBstrE n.)penBE

    0esponse.8rteBXConnnete!E Cath ex s xepton 0esponse.8rteBex.6essage.(otrngBEE n! (r, n! u+

    Protete! o! PageLoa!BE A onnetBE In! Class

    OUTPUT!

    &- onnete! to !ata+ase C)**C(' wll +e !spla,e! else F(6 8&(4 (40)8 YCP(&)* message relate! to the esta+lshment -or the !ata+ase

  • 8/11/2019 Software Testing Programs

    11/23

    SORTING OF ARRAYS

    #nlu!e#nlu!e

    o! manBEAnt lst1N2SDlstN2SDsortlstNT2SHnt&DDnDmDtempDseHlrsrBEHprnt-BXRt Creatng two arra,EHprnt-BXRn nter the se o- -rst lst:EHsan-BX%!DJnEHprnt-BXRn nter the elements:EH-or B=2H

  • 8/11/2019 Software Testing Programs

    12/23

    OUTPUT!

    C0(&*W (8) 00F

    nter the se o- the -rst lst : 3nter the elements : 1 3 nter the se o- the seon! lst : 3nter the elements : T Zlements n the -rst lst : 1 3 lements n the seon! lst : T Z6ergng an! sortng lst : 1 3 T Z

    MERGING AND SORTING

    ((O&'(('C0&P(&)*

    (( (PYPC(')(P(

    C(L)(P(

    ((

    (CO)0(O21 eptaneo- gen noo- arra,elements-or arra,lst1NS

    &nput arra,elements

    eptnggennum+er o-arra,elements

    epte!gennum+er o-arra,elements

    uess

    (CO)0(O2 *onO

    aeptaneo- morethan gennum+er o-arra,elements

    &nput arra,

    elements

    (he alue

    -orlst1NnG1Sshoul! not+e aepte!

    (he alue

    -orlst1NnG1Ss notaepte!

    uess

    (CO)0(O23 *onOaeptaneo-harater-or thearra,elements

    &nput har[x\

    (he alue-orlstNnG1Sshoul! not+e aepte!

    (he alue-orlst1NnG1Ss notaepte!

    uess

    (CO)0(O2T 6ergng two

    arra,s

    &nput !ata (he sorte!

    lst haenGm num+ero- arra,elements

    (he alue

    -orlst1NnG1Ss notaepte!

    uess

    (CO)0(O2 orte!arra,elements

    &nput !ata rra,elementsare sorte!nasen!ng

    (he alue-orlst1NnG1Ss notaepte!

    uess

  • 8/11/2019 Software Testing Programs

    13/23

    or!er

  • 8/11/2019 Software Testing Programs

    14/23

    PALINDROME

    #nlu!e#nlu!e

    #nlu!eo! manBEAlrstBEHhar aHhar ?strDstr1NSHount

  • 8/11/2019 Software Testing Programs

    15/23

    PALINDROME

    ((O&'(('C0&P(&)*

    (( (PYPC(')(P(

    C(L)(P(

    ((

    (COPLO21 eptane

    o- numerharater nnput strng

    &nput

    nterger*um+er

    *umer

    alueshoul! +eaepte!

    *umer

    alueaepte!

    uess

    (CO PL O2 *onOaeptaneo- strngnot morethan 12 har

    &nput onl,strngwthn 12har

    trng morethan 12har shoul!not +eaepte!

    trng>2haraepte!

    5alure

    6o!-, n.getlneBstrD2E to ngetlneBstrD12E an! run the program o- ((O&'(COPLO2(CO PL O2 *onO

    aeptaneo-

    strng notmore than 12har

    &nput onl,strng wth

    n 12 har

    trng morethan 12

    har shoul!not +eaepte!

    trng notaepte!

    uess

    (CO PL O23 0eerseoperatonper-orme!+ut not!spla,e!

    &nput thestrng

    trnga-terreerseshoul! not+e!spla,e!

    0eersestrng s!spla,e!

    5alure

    6o!-, strreBstrE that s ao! strreBE an! run the program o- ((O&' (COPL O23(CO PL O23 0eerse

    operatonper-orme!

    +ut not!spla,e!

    &nput thestrng

    trnga-terreerse

    shoul! not+e!spla,e!

    0eersestrng not!spla,e!

    uess

    (CO PL O2T trng not apal!romeare reerse!

    &nput thestrng

    trng nota pal!romes aepte!

    Paln!romestrng notaepte!

    uess

    (CO PL O2 trng spal!romeonl, - +othare eual

    Cop, thenputstrng tothe!estnatonstrng

    ualnum+er o-haratersshoul! +eo+sere!

    tr1 ssame as str

    suess

  • 8/11/2019 Software Testing Programs

    16/23

    STUDENT DETAILS

    #nlu!e#nlu!e

    o! manBEAnt m1DmDm3DmTDmTDmDtotHlrsrBEHprnt-BXRt tu!ent !etalsEHprnt-BXRnRt ??????????lsEHprnt-BXRn nter the taml su+et mar;:EHsan-BX%!DJm1EHprnt-BXRn nter the englsh su+et mar;:EHsan-BX%!DJmEHprnt-BXRn nter the maths su+et mar;:EHsan-BX%!DJm3EHprnt-BXRn nter the sene su+et mar;:EH

    san-BX%!DJmTEHprnt-BXRn nter the soal sene su+et mar;:EHsan-BX%!DJmEHtot = m1GmGm3GmTGmHprnt-BXRn (otal: %!DtotEH-Bm1>3 JJ m>3 JJ m3>3 JJ mT>3 JJ m>3EAprnt-BXRn 0esult: PEHIelseAprnt-BXRn 0esult: 5&LEHIgethBEHI

    OUTPUT!

    ('*( '(&L?????????????

    nter thetaml su+et mar; : 9nter theenglsh su+et mar; : 9Znter themaths su+et mar; : 2nter the sene su+et mar; : 1nter the soal sene su+et mar; : 92(otal : T3

    0esult : P

  • 8/11/2019 Software Testing Programs

    17/23

    STUDENT DETAILS

    ((O&'(('C0&P(&)*

    (( (PYPC(')(P(

    C(L)(P(

    ((

    (CO('O21 eptane

    o- sngle!gt nmar;s

    &nput

    sngle!gtnum+er

    houl! +e

    aepte!

    $alue

    aepte!

    uess

    (CO ('O2

    eptaneo- numeralue nresult

    &nputnumeralue

    *umeralueshoul! +eaepte!

    *umeralue notaepte!

    5alure

    6o!-, alue m1 to m an! run the program ((O&' (CO('O2 agan(CO ('O2

    eptaneo- numeralue nresult

    &nputnumeralue

    *umeraluehoul! +eaepte!

    &nput alueaepte!

    uess

    (CO ('O23

    Wet thenput -rstan! then!spla,

    &nput allthe !etals-rst

    'etalsshoul! +eget -rstan! then!spla,e!

    ser nputaepte!-rst an!!spla,e!

    suess

    (CO ('O2T]

    'spla,ngXpass eenmar;s3Dm>3Dm3>3 to m1

  • 8/11/2019 Software Testing Programs

    18/23

    STACK OPERATION

    #nlu!e#nlu!e

    o! manBEAnttopDhDDDsta;N12SHhar HlrsrBEHprnt-BXRn Rt Rt (C^ )P0(&)*EHprnt-BXRn Rt Rt ???????????????EHprnt-BXRn nter the range o- the sta; elements :EHsan-BX%!DJtopEHprnt-BXRn nter the sta; elements :EH-orB=2H=12EPrnt- BXRn (C^ & 5LLEHlseAprnt- BXRn nter the element :EH

    san- BX%!Dsta;NtopSEHtop = top G 1HI7rea;H

    Case :&-Btop

  • 8/11/2019 Software Testing Programs

    19/23

    I

    OUTPUT!

    nter the range o- the sta; elements : 3nter the sta; elements : 1 3

    1.P4.P)P3.L&(

    nter ,our hoeB1//3E : 1nter the element : T'o ,ou want to ontnue B,/nE : F

    1.P4.P)P3.L&(

    nter ,our hoeB1//3E : 3

    ta; elements are : 1 3 T'o ,ou want to ontnue B,/nE : F

    1.P4.P)P3.L&(

    nter ,our hoeB1//3E : (he poppe! elements s : T'o ,ou want to ontnue B,/nE : F

    1.P4.P)P3.L&(

    nter ,our hoeB1//3E : 3ta; elements are : 1 3'o ,ou want to ontnue B,/nE : n

  • 8/11/2019 Software Testing Programs

    20/23

    STACK OPERATION

    ((O&'(('C0&P(&)*

    (( (PYPC(')(P(

    C(L)(P(

    ((

    (CO(C^O21 eptane

    o- gen noo- sta;elements

    &nput sta;

    elements

    eptng

    gennum+er o-elements

    epte!

    gennum+er o-elements

    uess

    (CO (C^O2

    *onOaeptaneo- morethan seo- arra,

    &nput sta;elements

    Largenum+er o-elementsthen thearra,shoul! not+e aepte!

    lementslarget thanthe se o-the arra,notaepte!

    uess

    (CO (C^O23

    Pop up theempt, sta;

    &nput !ata ta; sempt,

    ta; sempt,

    uess

    (CO (C^

    O2T

    Push nto

    -lle!sta;

    &nput !ata ta; s

    -ull

    ta; s

    -ull

    uess

    (CO (C^O2

    eptaneo- !ata -ortheara+le o- userhoe

    &nput an,har !ataXn

    (ermnatngtheexeuton

    (ermnatestheexeuton

    uess

    (CO (C^O2Z

    eptaneo- !ata -ortheara+le o- userhoe

    &nput an,har !ataXa

    (he loopshoul! +eontnue

    Loopontnues

    uess

    (CO (C^O2_

    'spla,ssta;elementwthoutsortng

    &nput asta;element

    ta;elementshoul! not+e sorte!

    talelement notstore!

    uess

    (CO (C^O29

    'eremento- sta;se - anelements spoppe!

    Pop an!element

    ta;elementshoul! +e!eremente!

    ta;element!eremente!

    uess

  • 8/11/2019 Software Testing Programs

    21/23

    QUEUE OPERATION

    #nlu!e#nlu!e

    o! manBEAntnDDN12SD?ptrN12SDhDrear=2D-ront=2Hhar HlrsrBEHprnt-BXRn Rt Rt ` )P0(&)*EHprnt-BXRn Rt Rt ???????????????EHprnt-BXRn nter the range :EHsan-BX%!DJnEHprnt-BXRn nter the ueue elements :EH-orB=2H

  • 8/11/2019 Software Testing Programs

    22/23

    5orB=-rontH

  • 8/11/2019 Software Testing Programs

    23/23

    QUEUE OPERATION

    ((O&'(('C0&P(&)*

    (((P

    YPC(')(P(

    C(L)(P(

    ((

    (CO`O21 *onOaeptane

    o- the -rstelements nthe ueue -the -ront an!rear are notero

    &nput

    ueueelements

    5rst

    elementshoul! not+e aepte!

    5rst

    element snotaepte!

    uess

    (CO `O2

    *onOaeptaneo- negateelements nthe ueue

    &nputnegateelements

    lementsshoul! not+e aepte!

    lementsnotaepte!

    uess

    (CO `O23

    *onOaeptaneo- haratern hoe

    &nputharater!ata

    Charater!ata shoul!not +eaepte!

    Charater!ata notaepte!

    uess

    (CO `O2T

    *onOaeptaneo- ueueelements -rear=n

    &nput theelements

    lementsshoul! not+e aepte!

    lementsnotaepte!

    uess

    (CO `O2

    0earnrements +,one - anelement sa!!e! to theueue

    &nput anelement

    0ear shoul!+enremente!to a!! theelement tothe ueue

    `ueuenrement s+, one

    uess

    (CO `O2Z

    `ueue s empt,- rear an!-ront s ero

    Lst outthe ueueelements

    `ueueshoul! +eempt,

    `ueue sempt,

    uess

    (CO `O2_

    Loop ontnuesto the nextase - +rea;statement sao!e!

    0emoethe +rea;statement

    Loop shoul!exeute thenext asealso

    Loopontnues

    uess

    (CO `O29

    lements nthe ueue arenot store!

    &nputran!omelement

    lementshoul! +e!spla,e!as t s

    lementsare!spla,e!as t s

    uess