Tag:Test code

  • Golang using GitHub actions CI tutorial


    GitHub actions is a new function introduced by GitHub, which can automatically build workflow for our project,For example, code checking, automatic packaging, testing, release and so on. The entry is next to the project pull requestGitHub actions is currently in the beta stage and needs to apply for beta experience qualificationGitHub actions beta application experience […]

  • Scope description in Maven dependency


    First, look at the MVN dependency in the project <dependency> <groupId>io.etcd</groupId> <artifactId>jetcd-core</artifactId> <version>${jetcd.vesion}</version> <scope>compile</scope> </dependency> It’s always strange why this SCOP is used today. Baidu finally understood and summarized here. Scope value Compile (default) test runntime provided system Compile (default) Jar package exists in compile, test and run phases test For test, it means that […]

  • API usage of zookeeper


    POM configuration Import zookeeper and JUnit <dependencies> <dependency> <groupId>org.apache.zookeeper</groupId> <artifactId>zookeeper</artifactId> <version>3.5.6</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency> </dependencies> Create session Before, for creating a session, this part of code will not be pasted later private static ZooKeeper zooKeeper; private static Stat stat = new Stat(); @Before public void before() { zooKeeper = ZookeeperConnect.getZookeeper(); } For […]

  • Zkclient of zookeeper


    In the use of zookeeper API, we have known the use of native API, but the registration of watcher and session timeout and reconnection of native API are tedious, so there are their own open source clients. Maven dependence <dependency> <groupId>com.101tec</groupId> <artifactId>zkclient</artifactId> <version>0.11</version> </dependency> Create session Before, for creating a session, this part of code […]

  • SharpC: A C Interpreter In C# – 1101


    If you run the following test c code contained in multiple recursive calls: … void fork2(int a, int b) { if ((a + b) % 1024 == 0) print(“iterate fork2: a=%i, b=%i\n”, a, b); if (a + b == 2) return; else fork2(–a, –b); } … void main() { … fork2(65535, 65535); … } Will […]

  • Programming gossip — performance comparison between STD:: vector and list


    Yesterday, after comparing the performance differences between the two methods of STD:: vector in C + + and leaving a record — Programming gossip — use replace back to replace push back, and today try to test the performance of corresponding functions in C ා. The data structure of STD:: vector in C is list。 […]

  • Zookeeper’s cursor


    I talked about the use of zookeeper’s API and the use of zookeeper’s zkclient. Now let’s take a look at the use of cursor. Maven dependence <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-framework</artifactId> <version>4.2.0</version> </dependency> Create session Before, for creating a session, this part of code will not be pasted later CuratorFramework client; @Before public void before() { client […]

  • Suggestions and skills for advanced version of go language test


    Before reading this article, you’d better know how to write basic unit tests. This article contains three tips and seven tips. Suggestion 1: do not use framework The go language itself has a great test framework, which allows you to write test code using go without having to learn other libraries or test engines. For […]

  • XML Mapping XML and Java object transformation mapping framework, read and write XML as gracefully as xStream


    xml XML is an XML framework implemented by Java. I hope to transform XML and Java in the most elegant way, and one line of code can do everything. Characteristic Mapping of objects and XML Support [email protected] an alias Support [email protected] ignored fields Change log CHANGE_LOG Quick start Get ready jdk 1.7+ maven 3.x+ Introduction […]

  • Ci practice of gitlab + Jenkins


    0x00 incident In order to update the application more efficiently, the practice of Ci is adopted. 0x01 process record 1. Jenkins settingsInstall plug-ins Gitlab Hook Plugin Build Authorization Token Root PluginConfigure Jenkins project Hook upBuild when a change is pushed to GitLab. GitLab webhook URL:, the later ULR will be used in gitlab; then click […]

  • Using river to build a specflow + xUnit + selenium automatic function test environment for web pages


    Run rider, create test solution, select xUnit, and click create to create ​   Import package: because I use Chrome browser (download the corresponding browser driver first), I import selenium.webdriver.chromeddriver package. When importing such package, the reader can keep the same with the browser he uses.    Note: do not import packages with beta fields after […]

  • C ා list: comparison of four methods of de duplication based on object attributes


    Test code: private void TestDistinct() { Task.Run(() => { //Generate test data DateTime dt = DateTime.Now; Random rnd = new Random(); List list = new List(); int total = 1000000; for (int i = 0; i < total; i++) { MyData info = new MyData(); info.id = rnd.Next(1, total * 10).ToString(); info.name = rnd.Next(1, total […]