[Key Points] Selenium + Nightwatch automated test environment construction

Start building 1. Create project Let’s find a place to create a new directory, name it “my-test-toolkit”, and then use the terminal in the directory to run npm init -y to generate the project configuration file< strong>package.json. 2. Installation tools Then we will install Selenium and Nightwatch. Install selenium-standalone: npm install selenium-standalone –save-dev Install Nightwatch: […]

[Data structure] PriorityQueue and heap

Whenthereisanincomingcallonthemobilephone,themobilephonewillalwaysgiveprioritytotheincomingcall.Inthiscase,aqueuewithpriorityisused.Inadatastructure,astructurethatcanaddnewobjectsandreturnthehighestpriorityobjectiscalledapriorityqueue.TheheapandPriorityQueueareapriorityqueue. Heap Whatisaheap Aheapisacompletebinarytree,andthevalueofeachnodeisalwaysnogreaterthanornolessthanthevalueofitsparentnode.Aheapthatisgreaterthanitsparentnodeiscalledabigrootheap,andaheapthatislessthanitsparentnodeiscalledaheap.Smallrootpile. Heapstoragemethod Becausetheheapisacompletebinarytree,itcanbestoredinthearrayinasequentialmanneraccordingtotheorderoflayer-ordertraversal(ifitisnotacompletebinarytree,emptynodesmustbestoredinthespace,whichwillleadtorelativelylowspaceutilization). Thecompletebinaryisstoredinthearrayinorder.Thesubscriptoftheleftchildnodeofnodeiis2*i+1,thesubscriptoftherightchildnodeis2*i+2,andthesubscriptoftheparentnodeis(i-1)/2. Thefollowingisthestoragestructureofthesimulatedheap: publicclassHeap{ //arraytostoreheap privateint[]elem; //Thenumberofvalidelementsintheheap privateintusedSize; //Defaultsizeofarray privatestaticfinalintDEFAULT_SIZE=10; //Constructorinitializesthearray publicHeap(){ elem=newint[DEFAULT_SIZE]; } } Creationofheap Aheapisaspecialcompletebinarytree.Wecancreateaheapbyadjustingdownwardanordinarybinarytree.Herewetakecreatingasmallrootheapasanexample. Thepicturebelowisaschematicdiagramofadownwardadjustment: Toconvertanordinarybinarytreeintoaheaprequiresmultipledownwardadjustments.Thespecificstepsareasfollows: Twolabels,parentandchild,arerequired.Letparentmarkthenodethatneedstobeadjusted,andchildmarktheleftchildofparent(ifparenthasachild,itmusthavealeftchildfirst).Ifparenthasaleftchild,performthefollowingoperations: 1.Determinewhethertheparent’srightchildexists.Ifitexists,letthechildmarkthesmallestnodeamongtheleftandrightchildnodes. 2.Compareparentandchild.Ifparentissmallerthanchild,theadjustmentends;ifparentislargerthanchild,swapparentandchild. 3.Aftertheexchangeiscompleted,thelargeelementsintheparentmovedownward,whichmaycausethesubtreetonotmeetthepropertiesoftheheap,soitneedstocontinuetoadjustdownward,thatis,parent=child;child=parent*2+1;andthencontinuewith1,2,3steps. //Buildaheap publicvoidcreateHeap(){ //Findthefirstnon-leafnodefromthelast,startfromthenodepositionandgoforwardtotherootnode.Whenencounteringanode,applydownwardadjustment for(intparent=(usedSize-1-1)/2;parent>=0;parent–){ //Adjustdownward shiftDown(parent,usedSize); } } //Adjustdownward publicvoidshiftDown(intparent,intlen){ //childfirstmarkstheleftchildoftheparent,becausetheparentmayhavealeftbutnotarightchild intchild=parent*2+1; while(child<len){ //Iftherightchildexists,findthesmallerchildamongtheleftandrightchildrenandmarkitwithchild if(child+1<len&&elem[child]>elem[child+1]){ child++; } if(elem[parent]>elem[child]){ //Theparentnodeislargerthanitssmallestchildnode //Swapparentnodewithsmallerchildnode inttmp=elem[child]; elem[child]=elem[parent]; elem[parent]=tmp; //Movinglargeelementsintheparentdownwardmaycausethesubtreetonotmeetthepropertiesoftheheap,soitneedstocontinuetobeadjusteddownward. parent=child; child=2*parent+1; }else{ […]

Python interface automated construction process, including request request encapsulation

Some thoughts at the beginning Interface test automation benefits The obvious benefit is freeing your hands. Can automatically execute a large number of test cases in a short time Improve test coverage by changing test data in a parameterized and data-driven manner Quick feedback on test execution results and reports Processes that support continuous integration […]

Data structure – sequence table

Article directory 1. Linear table 2. Sequence table 2.1 Concept and structure 2.2 Interface implementation (1) Sequence table initialization (2)Sequence table destruction (3) Sequence table expansion (4) Tail insertion data (5)Head plug data (6) Insert x before the data with subscript pos (7) Tail deleted data (8) Header deletion data (9) Delete the data with […]

[MySQL installation and cluster construction in Linux environment]

Article directory 1. Install MySQL8.X in Linux environment 1.1. Configure network card information in Linux environment 1.2. Remotely pull the MySQL8.x installation package 1.3. MySQL installation and related parameter configuration 1.4. MySQL startup and remote connection settings 2. MySQL master-slave cluster construction 2.1. Purpose and reasons for cluster construction 2.2. Problems in building a MySQL […]

Lesson 21 Data storage & structure in memory

Storage of floating point numbers in memory How floating point numbers are stored According to the IEEE 754 standard, floating point numbers can be written as: (-1)^S *M*2 ^E. Just store S, M, and E in the memory. S, M, and E are all binary numbers, so when storing decimal floating-point numbers, they need to […]