Kwayedza Zvekushandisa Zvishandiso zveKuyedza ReactJS Zvishandiso

Ndiri kuronga kuyedza ReactJS kunyorera uye ndaida kuona kuti ndechipi chakanakisa chishandiso kunze uko mumusika kuti uite kumagumo-kumagumo bvunzo? Mushure mekuita katsvagurudzo ndakaona kuti kune akawanda maturusi anowanikwa kuyedza ReactJS kunyorera asi ndeipi yakanyanya kunaka yekushandisa kumagumo-kumagumo bvunzo?

Mhinduro:

Iko hakuna pfungwa ye 'yakanakisa chishandiso' kana zvasvika kune otomatiki kuyedza. Izvo zvese zvinoenderana nemamiriro eprojekti yako uye nezvamunoda kuwana kubva chishandiso.

Ndakaedza zvese Angular uye ReactJS kunyorera uye ini ndakangoshandisa Selenium WebDriver seyedzo yekushandisa otomatiki yekugadzira ekupedzisira-kumagumo bvunzo. Nekudaro, panoratidzika kunge paine huwandu huri kukura hweJS based test automation maturusi uye masystem ekuyedza ReactJS kunyorera. Aya maturusi anoita kunge anofarirwa kwazvo pakati pevagadziri ve 'kumberi-kumagumo' sezvo ari maringe nevavaki vemitauro vanoziva, JavaScript.

Izvi zvinoreva kuti havasi ivo chete vaedze vanogona kunyora zvoga magumo bvunzo-kumagumo, asi vanogadzira vanogona zvakare kubatsira kana pasina nguva yakakwana kana zviwanikwa.

Pazasi pane runyorwa rweyedzo automation maturusi uye masystem ekuyedza ReactJS application:



Kwayedza Zvekushandisa Zvishandiso zveReactJS

WebDriver.io

WebdriverIO ndeye yakavhurika sosi yekuyedza utility ye Node.js . Inoita kuti zvikwanise kunyora super nyore selenium bvunzo neJavascript mune yako yaunofarira BDD kana TDD bvunzo fomati.

Nightwatch.js

Nightwatch.js iri nyore kushandisa Node.js based End-to-End (E2E) yekuyedza mhinduro ye browser-based apps nemawebhusaiti. Inoshandisa vane simba W3C WebDriver API kuita mirairo uye zvirevo pazvinhu zveDOM.

NightmareJS

Nightmare iri yepamusoro-chikamu browser otomatiki raibhurari kubva Chikamu .

Pasi pemabutiro, inoshandisa Erekitironi , iyo yakafanana ne PhantomJS asi zvakapetwa kaviri nekukurumidza uye zvakanyanya zvemazuva ano.

Niffy chishandiso chekuona chakasiyana chakavakirwa paNightmare. Iyo inokubatsira iwe kuona UI shanduko uye zviputi pane kuburitswa kwewebhu webhu yako.

Kufungidzira ndeyekuwedzera chrome yekuwedzera yakavakwa ne @ stevenmiller888 iyo inogadzira zvinyorwa zveNightmare zvako iwe paunenge uchitarisa.

Ndizvo

Jest inoshandiswa neFacebook kuyedza kodhi yese yeJavaScript inosanganisira React kunyorera. Imwe yefilosofi yaJest ndeyekupa yakasangana 'zero-kumisikidzwa' chiitiko. Isu takaona kuti mainjiniya pavanopihwa maturusi ekugadzirira kushandisa, vanozopedzisira vonyora bvunzo, izvo zvinozoguma zvigadzikana uye zvine hutano makodhi. Jest zvakare inofanidza bvunzo inomhanya pakati pevashandi kuwedzera basa.

Mocha

Ipo Jest ichizivikanwa pakati pevagadziri veFacebook kunyora otomatiki bvunzo dzeReactJS kunyorera, ine dzimwe nyaya (kunonoka, kuseka kunovhiringidza). Mocha yave nzira inozivikanwa. Zvinonyanya kurwadza kumisikidza asi zvinogona kunge zvakakodzera kutarisa. Ini ndinotarisira kuti iwedzere kufarirwa mune ramangwana kunze kwekunge Jest ikunda dzimwe dzenyaya huru. Maona Kwayedza React Web Apps neMocha kutanga.

Protractor

Zvekugamuchirwa kuyedzwa, unogona kufunga Mudziviriri. Icho chinonyanya chinhu cheAngular chishandiso chakavakirwa pamusoro peSelenium uye inouya neyakanaka API. Neraki, zvinokwanisika kumisikidza kuti ishande neReact. Chinhu cheNice nezve iyi nzira ndechekuti izvi zvinokutendera kuti uedze yako application uchipesana nemhando dzakasiyana dzemabhurawuza.

Enzyme

Enzyme is JavaScript Testing utility yeReact iyo inoita kuti zvive nyore kusimbisa, kushandisa, uye kuyambuka yako React Components 'kuburitsa. Pakutanga yakagadzirwa neAirbnb, iri kuramba ichiwedzera kufarirwa. Unogona kuishandisa nechero muyedzo wekumhanya (mocha, jasmine,…) uye pane zvinobatsira chai-enzyme pfekera.

Enzyme + Mocha inoita kunge yakasarudzika musanganiswa kuyedza webhu kunyorera kwakanyorwa muReactJS. Izvo zviri nyore kudzidza, kunyangwe kune mumwe munhu mutsva kuReactJS uye Mocha anogona nyore kubata nematurusi aya munguva pfupi.