Cov Lus Qhia thiab Cov Kev Coj Ua Zoo Tshaj Plaws rau Kev Ntsuam Xyuas Kev Muag Khoom Ua Si

salesforce kev koom ua ke

Kev soj ntsuam kev muag khoom yuav pab koj ua kom raug raws li koj lub siab nyiam Salesforce kev sib xyaw thiab kev ua haujlwm nrog rau lwm cov ntawv thov kev lag luam. Ib qho kev xeem zoo yog siv tag nrho cov Salesforce modules los ntawm cov nyiaj coj, los ntawm cov sijhawm rau cov ntawv ceeb toom, thiab los ntawm cov phiaj xwm mus rau cov neeg. Raws li qhov xwm txheej ntawm txhua qhov kev ntsuam xyuas, muaj txoj kev ua tau zoo (zoo thiab muaj txiaj ntsig) ntawm kev ua qhov kev xeem Salesforce thiab txoj kev ua tsis zoo. Yog li, Dab tsi yog Salesforce kuaj kev coj ua zoo?

  • Siv Cov Cuab Yeej Los Soj Ntsuam Siv - Kev soj ntsuam kev muag khoom tshwm sim hauv qhov browser lossis hauv ib puag ncig dab noj hnub. Ob qhov kawg browsers thiab dab noj hnub muaj qhov zoo debugging cov cuab yeej thiab koj tuaj yeem ua ke cov no nrog cov chav kawm sim rau kev tshwm sim tau zoo heev. Txawm li cas los xij, yog tias koj xav tau ntau dua, Apex Sib tham sib Debugger (lossis yooj yim Apex) los ntawm Force.com yuav tsum tau siv. Nco ntsoov koj tseem tuaj yeem siv Cov Neeg Soj Ntsuam Hluav Taws Xob, ib chrome txuas ntxiv, kom tshwj xeeb sim Salesforce Xob Laim. Apex yog a Yuam Kev ..com platform cov ntsiab lus tshaj tawm cov lus ua lag luam uas muaj cov xwm txheej zoo sib xws nrog Java. Nws yog cov hom phiaj kev taw qhia, rooj plaub-insensitive, muaj zog hom lus programming ua raws curly-nkhaus thiab dot-cim syntax. Koj tuaj yeem siv Apex kom ua tiav cov haujlwm programmed thaum siv cov txheej txheem feem ntau Force.com, suav nrog cov kab cim kev sib txuas thiab cov khawm, hloov kho tshiab, tshem tawm, thiab sau cov teeb meem tuav ntawm tes los ntawm Visualforce phab kev cai tswj lossis teem sijhawm.
  • Siv Cov Kev Cai Lub Npe Zoo - Sau npe rau koj txoj kev kuaj mob ua ntej koj pib sau ntawv cov ntawv xeem tseem ceeb heev. Lub npe xeem tus qauv yuav tsum muaj peb ntu. Cov no yog npeOfMethod (lub npe ntawm tus qauv uas koj tab tom sim xws li ntxig / hloov kho / rho tawm / tsis tshem tawm thaum sim qhov ntsuas, cov ntaub ntawv hais txog TestPath uas yoog raws xws li thov hu yog tias koj tab tom kuaj tias kev sib cuag yog tsis zoo, thiab siv tau thaum kuaj qhov zoo / txoj kev tsis zoo.
  • Xyuas kom 100% Duav - Txawm hais tias tus txheej txheem muag ncaj rau Salesforce yog tias kev ntsuas ntsuas yuav tsum muaj kev tiv thaiv 75% ntawm koj cov cai (rho tawm cov chav kawm xeem, hu rau System.debug thiab kev sim) thiab koj yuav tsis tuaj yeem siv Apex code lossis pob AppExchange hloov, koj yuav tsum Nco ntsoov tias qhov no tsuas yog tus qauv thiab koj lub hom phiaj yuav tsum yog 100% kev tiv thaiv. Ntsuas tag nrho cov qhov teeb meem zoo / tsis zoo thiab rau cov ntaub ntawv uas muaj tam sim no thiab tsis hais tam sim no. Lwm cov lus qhia tseem ceeb thaum nws los txog rau kev cai them nqi yog:
    • Koj yuav tsum khiav kev ntsuam xyuas los kho cov kev cai them cov lej txij li cov lej no tsis hloov dua tshiab thaum Apex code tau hloov kho kom txog thaum kev ntsuam xyuas tau rov ua dua.
    • Yog tias muaj kev hloov kho hauv lub koom haum txij thaum kawg xeem dhau los, muaj kev pheej hmoo tias txoj cai tus lej yuav tsis raug. Rerun cov kev ntsuam xyuas rau qhov tsim nyog kwv yees.
    • Feem pua ​​ntawm txoj cai tswj kev lag luam tsis suav nrog cov cai tswj hwm los ntawm cov kev tswj xyuas pob khoom, tsuas yog qhov kev zam tau tsuas yog thaum qhov kev ntsuas no ua rau cov hluav taws kub nyhiab.
    • Cov kev pab yog nyob ntawm tus lej ntawm kab kev cai. Yog tias koj ntxiv lossis lawb tawm cov kab kev cai, koj yuav cuam tshuam qhov feem pua.
  • Kev Ntsuas Cov Ntawv hauv Cov Chav Kawm thiab Cov Tswj Khoom - Hauv kev txhim kho Salesforce, feem ntau cov neeg tsim khoom tsim cov chav cais thiab cov ntaub ntawv tswj hwm rau txhua txoj haujlwm. Qhov no ua tiav los ua cov coding ntau txheej txheem, yooj yim dua, rov siv dua, thiab siv tau yooj yim. Koj yuav tsum, txawm li cas los xij, nco ntsoov tias thaum qhov no yooj yim dua, nws tsis ua hauj lwm zoo dua. Koj yuav ua tiav txav chaw yog tias txoj cai xeem nyob hauv chav kawm ib txwm thiab tus tswj lub cim nws tus kheej txij li koj yuav tsis nco ib yam kev xeem twg thaum tsiv los ntawm sandbox mus rau ntau lawm.
  • Siv System.assert () - Hauv Apex, System.assert() siv los kuaj xyuas cov mob. Qhov no yog qhov tseem ceeb ua haujlwm txij li nws tso cai rau koj los txiav txim siab yog tias ib txoj haujlwm twg tau ua los ntawm cov qauv raws li qhov xav tau. Koj yuav tsum siv System.assertEquals () thiab System.assertNotEquals () ntawm kev ua haujlwm tseem ceeb tsis yog pab koj txiav txim siab yog tias txoj cai tau ua tiav raws li nws yuav tsum tau ua, tab sis kuj tseem kom ntseeg tau tias tsis muaj ntaub ntawv sau yuam kev yog tias tus lej yuam kev.
  • Ntsig Txog Lub Neej - Kev ntsuas yuav tsum tau ua txhua yam. Koj yuav tsum ua cov kev ntsuas zoo, ntsuas kev sim, ntsuas kev nyab xeeb, thiab kuaj kev xa tawm.
  • Kev Xeem Ntawv - Koj yuav tsum muaj chav ntsuas kom paub tseeb tias cov ntaub ntawv ib leeg ua qhov raug thiab qhov txiaj ntsig tau. Thaum siv qhov ntsuas loj heev uas suav tag nrho cov cai yuav zoo li lub tswv yim zoo, nco ntsoov tias cov txiaj ntsig tsim tawm yuav nyuaj rau qhov debug thiab tsis ua haujlwm yuav nyuaj rau nkag siab. Chav ntsuas yuav tsum them ib qho me me ntawm lub luag haujlwm raug kuaj.
  • Kuaj Rau Tej - Kev sim tus lej zoo (txhais, zam lossis chav kawm) tuaj yeem koom nrog txog ntau pua pua cov ntaub ntawv (200 rau Apex). Koj yuav tsum tau ua qhov zoo ntawm qhov no thiab xeem tsis yog qee tus ntaub ntawv, tab sis tseem ua haujlwm feem ntau.
  • Kev Kuaj Zoo - Ntsuam xyuas kom paub tseeb tias qhov kev xav coj cwj pwm tshwm sim los ntawm txhua qhov kev cia siab pom zoo. Qhov kev xeem yuav tsum xyuas kom paub tseeb tias tus neeg siv siv tau ua daim ntawv foos tiav thiab tias nws tsis dhau cov kev txwv.
  • Kev Ntsuam Xyuas Tsis Zoo - Kuaj cov kis tsis zoo kom ntseeg tau tias cov lus yuam kev raug tsim tawm kom raug. Piv txwv ntawm cov teeb meem tsis zoo no tsis muaj peev xwm hais qhia cov nqi tsis zoo thiab tsis tuaj yeem ntxiv rau hnub tom ntej. Cov kev ntsuas tsis zoo yog qhov tseem ceeb vim tias kev tuav qhov tseeb thaum cov khoom mus sab qab teb tuaj yeem ua rau txhua qhov sib txawv.
  • Kev Ntsuam Xyuas Dhau Los - Kev lig kev cai, Salesforce kev xeem yog phau ntawv. Koj yuav tsum xav txog kev sim kuaj cov tshuab raws li qhov no muaj ntau yam zoo. Cov no suav nrog:
    • Los ntawm kev tshuaj xyuas ua rau koj raug rau qhov tsis raug vim tias kuaj yog los ntawm tib neeg thiab tsis yog neeg hlau. Cov neeg hlau ua tau zoo tshaj ntawm kev ua ub no thaum tib neeg ua yuam kev vim kev laj, txo qis thiab ua zoo, thiab ib qho nyiam txiav plaub fab.
    • Kev tuav phau ntawv yog qhov rov ua dua qub, siv cov mis thiab tiring. Pawg neeg ntsuam xyuas tau zoo dua los ua cov haujlwm uas muaj kev tshawb nrhiav ntau dua.
  • Ua rau txhua tus lej Logic ceg - Thaum siv cov cai logic (thaum koj tau suav nrog kev ua haujlwm ternary), txhua ceg ntawm qhov chaws cav yuav tsum raug tua.
  • Siv Qhov Tsis Raug thiab Siv Tau Qhov Siv Rau Cov Hu rau Txoj Kev - Kev hu mus rau cov hau kev yuav tsum tau ua kom siv ob qho kev siv tsis raug thiab kev siv nkag.
  • Ua Tiav - Xyuas kom meej tias cov kev ntsuam xyuas ua tiav tiav - lawv yuav tsum tsis txhob dhau los ntawm kev zam tshwj tsis yog tias muaj qhov xav tsis raug. Siv txhua yam kev zam uas ntes tau - ntes lawv yog qhov tsis zoo.
  • Siv Yuam DUA BY Keywords - Txhawm rau kom koj cov ntaub ntawv raug xa rov qab nyob rau hauv qhov kev txiav txim koj xav kom lawv, siv ORDER BY keywords.
  • Tsis txhob kwv yees tus lej ID tau npaj ua Sequentially - Zam kev ua txhaum qhov tsis raug ntawm kev kwv yees tus lej ID tau teeb tsa ua ntu zus mus. Cov npav ID tsis nyob hauv nce ntxiv, tshwj tsis yog koj tau sau ntau cov ntaub ntawv nrog tib qhov kev thov.
  • Hu Test.startTest () thiab Test.stopTest () - Thaum koj khiav Apex chav kuaj, koj yuav tau txais ntau dua li 75% cov kev cai them nqi uas yuav tsum ua hauv Salesforce. Koj yuav tsum hu rau stopTest ua ntej kev lees paub los yuam asynchronous cov lis dej num uas tej zaum tseem yuav khiav kom tiav. Khiav cov lus nug tshiab rau qhov kawg vim tias lwm tus code yuav hloov cov ntaub ntawv. UseTest.startTest () thiab Test.stopTest () kom koj sandbox qhov kev kuaj hauv nws tus tswv xeev txwv. Txoj kev no, kev teeb tsa tus txheej txheem koj siv yuav tsis cuam tshuam thiab muab koj cov lus tsis zoo lossis ua rau lwm tus nyob puag ncig tus tswv xeev txwv. Test.stopTest () tseem ua kom ntseeg tau tias @future hu yuav ua tiav rau kev sim.
  • Nyeem - Muaj peev xwm nyeem tau yog ib qho tseem ceeb heev hauv kev ntsuas chav. Cov npe xeem yuav tsum muaj kev txiav txim tshwj xeeb kom ua thiab qhov txiaj ntsig tau tshwm sim. Cov txheej txheem yuav tsum tau piav qhia thiab luv luv. Txoj kev yuav tsum yog xws li nws tuaj yeem rov siv dua nyob rau ntau qhov kev sim.
  • Tsim Cov Kev Ntsuas Cov Ntaub Ntawv Loj Ua Ntej startTest - Txij li thaum koj qhov kev ntsuam xyuas yuav tau khiav hauv cov sandbox sib txawv thiab cov chaw tsim khoom, tsim cov ntawv loj cov ntaub ntawv kuaj ua ntej koj hu rau startTest kom ntseeg tau tias qhov kev xeem muaj kev txwv tag nrho. Yog lub neej ntawd, Kev Muag Khoom Github sau cov ntawv sib cais los ntawm cov ntaub ntawv ntau lawm. Thaum koj xav tau qhov system cov ntaub ntawv xws li Profile, cov lus nug kom tau qhov tseeb rau qhov chaw ib puag ncig ntawd.
  • Tsim Kom Muaj Koj Cov Ntaub Ntawv Kev Ntsuam Xyuas - Cov ntaub ntawv kuaj ua koj siv yuav tsum tsim nyob rau hauv kev xeem. Koj tuaj yeem tsim cov ntaub ntawv no siv @testSetup annotation thiab ib hoob TestUtils tsis yog kom koj muaj cov ntaub ntawv zoo xwb, tabsis tseem yuav xyuas kom txhua qhov kev ntsuam xyuas tau khiav ntawm cov xuab zeb tsim tawm uas tsis muaj qhov xav tau ntawm cov ntaub ntawv.
  • Zam tsis muaj-op AKA thov haujlwm - Ntau tus neeg sim siv tsis muaj-op AKA thov haujlwm. Cov no yog cov cim tsis muaj nuj nqis uas tsis ua dab tsi. Txij li thaum lawv twb nyob hauv koj qhov code, lawv yuav ntxiv rau koj cov feem pua ​​kev tiv thaiv.
  • Ntsuas Kev Ntsuas Ua Ntej Thaum koj pib kev xeem los ntawm Salesforce cov neeg siv interface lossis tus Tsim Txheej Txheem Kev Tsim Tsa, qhov kev tshuaj ntsuam yuav khiav ua ib txhij. Qhov no yog ib qho tseem ceeb raws li nws ceev nce lub sij hawm mus kuaj. Koj yuav tsum, txawm li cas los xij, nco ntsoov tias qhov no tuaj yeem ua rau cov ntaub ntawv tsis sib haum thiab yog tias koj xav tias qhov no yuav tshwm sim, tua cov kev ua tiav khiav ua ke. Cov teeb meem feem ntau ua rau cov ntaub ntawv tsis sib haum xeeb uas feem ntau ua rau UNABLE_TO_LOCK_ROW yuam kev yog:
    • Thaum cov kev xeem tau txhais los hloov kho cov ntaub ntawv tib lub sijhawm. Kev hloov kho ntawm tib cov ntaub ntawv feem ntau tshwm sim thaum kev ntsuam xyuas tsis tsim lawv cov ntaub ntawv.
    • Thaum muaj lub cev tuag hauv kev sim uas tau khiav hauv kev sib luag thiab lawv sim los tsim cov ntaub ntawv uas muaj qhov sib piv cov ntsiab lus teb. Lub sijhawm kawg yuav tshwm sim thaum 2 cov kev sim ua haujlwm tau xaj rov qab los ua cov ntaub ntawv rov qab (qhov no tshwm sim thaum 2 qhov kev xeem ntsuas cov ntaub ntawv uas muaj tib lub cim ntsuas qhov tseem ceeb hauv cov ntawv sib txawv).
    • Txhawm rau tua cov kab sim ua tiav thaum ua tiav, mus rau Teeb, nkag rau Apex Test, mus rau Apex Test Execution Options, xaiv Disable Parallel Apex Testing, nyem OK.

Kev Siv Parallel Pape Apex Kev Tshuaj Ntsuam

Ntiav cov pro rau txoj haujlwm vim nws yuav muaj kev paub thiab kev cob qhia tsim nyog los ua qhov kev xeem zoo, uas tseem ua rau koj muaj kev thaj yeeb nyab xeeb. Ntiav cov pro pub rau koj mloog zoo rau koj txoj hauj lwm tseem ceeb. Nws tseem txuag nyiaj rau koj vim tias koj yuav tsis xav tau ib pab neeg hauv tsev ua haujlwm.

Yuav ua li cas koj xav hais tias?

Qhov Web site no siv Akismet los txo cov kev pabcuam. Kawm li cas koj cov ntaub ntawv tawm tswv yim tiav.