Actiger跳跳虎

Ingress-Ningx配置多个SSL证书

1. 起因 我删除域名服务商对顶级域名(即一级域名)的默认的重定向, 直接指向的我服务地址 使用的通配的二级域名证书 访问顶级域名像actiger.com, 浏览器弹出安全提示了. 发现, 通配的二级域名证书不能用在actiger.com上 2. 申请顶级域名actiger.com的证书. 申请过程参照这里 3. Ingress Nginx的配置my-nginx.yml apiVersion: extensions/v1beta1 kind: Ingress metadata: namespace: nginx-space name: my-nginx spec: tls: - hosts: - weini.actiger.com - www.actiger.com secretName: ingress-secret - hosts: - actiger.com secretName: ingress-top-secret rules: - host: weini.actiger.com http: paths: - backend: serviceName: my-nginx servicePort: 80 - host: www.actiger.com http: paths: - backend: serviceName: my-nginx servicePort: 80 - host: actiger.com http: paths: - backend: serviceName: my-nginx servicePort: 80 - host: test....

Moco示例

1. Moco是什么? 简单的模拟服务器的程序库/工具, 有请求给出响应.在地址中下载moco-runner-0.12.0-standalone.jar. 2. 使用示例 1. 创建test.json [ { "description": "First test", "request": { "uri": "/demo" }, "response": { "text": "First Response" } } ] 2. 命令行启动服务, moco-runner-0.12.0-standalone.jar与test.json在相同目录下. java -jar ./moco-runner-0.12.0-standalone.jar http -p 8888 -c test.json 3. 验证 访问http://localhost:8888/demo 2. 模拟一个带参数的请求, para.json [ { "description": "模拟一个有参数的Get请求", "request": { "uri": "/getpara", "method": "get", "queries": { "name": "xiaoming", "age": "20" } }, "response": { "text": "I am on the way....

TestNG生成测试报告

1. 使用的extentreports生成的测试报告, 报告中使用的css文件需要上强(墙) <dependency> <groupId>com.aventstack</groupId> <artifactId>extentreports</artifactId> <version>4.0.9</version> </dependency> 测试方法 package com.actiger.reports; import org.testng.Assert; import org.testng.Reporter; import org.testng.annotations.Test; public class TestReport { @Test public void test1(){ Assert.assertEquals(1,2); } @Test public void test2(){ Assert.assertEquals(1,1); } @Test public void test3(){ Assert.assertEquals(3,3); } @Test public void log1(){ Reporter.log("这是日志"); throw new RuntimeException("这是一个异常"); } } 配置的xml <?xml version="1.0" encoding="UTF-8" ?> <suite name="mytest"> <test name="test"> <classes> <class name="com.actiger.reports.TestReport"> <method> <include name="test1"></include> <include name="test2"></include> <include name="test3"></include> <include name="log1"></include> </method> </class> </classes> </test> <listeners> <listener class-name="com....

TestNG超时测试

TestNG超时测试 超出预期时间则用例失败 package com.actiger.test.timeout; import org.testng.annotations.Test; public class TimeOut { @Test(timeOut = 3000) public void testSuccess() throws InterruptedException{ Thread.sleep(2000); } @Test(timeOut = 2000) public void testFail() throws InterruptedException{ Thread.sleep(3000); } } ...

TestNG多线程配置

1. 在方法注释中配置多线程, 配置线程池 package com.actiger.test.thread; import org.testng.annotations.Test; public class MultiThread { @Test(invocationCount = 10, threadPoolSize = 3) public void test(){ System.out.println("1"); System.out.println("Thread ID:%s%n" + Thread.currentThread().getId()); } } 2. 在xml中配置多线程, 不可配置为线程池. package com.actiger.test.thread; import org.testng.annotations.Test; public class MultiThreadOnXml { @Test public void test1(){ System.out.println("Thread ID: " + Thread.currentThread().getId()); } @Test public void test2(){ System.out.println("Thread ID: " + Thread.currentThread().getId()); } @Test public void test3(){ System.out.println("Thread ID: " + Thread.currentThread().getId()); } } multiThread....

TestNG参数化测试

1. 参数化测试, 使用DataProvider来参数化. @Test中dataProvider的名字与@DataProvider名称一致 @Test(dataProvider = "data") public void dataProvider(String name, int age){ System.out.println("Name:" + name + ", " + "Age:" + age); } @DataProvider(name = "data") public Object[][] data(){ Object[][] oo = new Object[][]{ {"zhangsan", 18}, {"lisi", 20}, {"wangwu", 30} }; return oo; } 2. 针对不方法识别, 使用不同参数 @Test(dataProvider = "testMethod") public void method1(String name, int age){ System.out.println("Name:" + name + ", " + "Age:" + age + "1111"); } @Test(dataProvider = "testMethod") public void method2(String name, int age){ System....

TestNG依赖测试和xml文件参数化

1. TestNG依赖测试, 1个用例依赖其他的测试方法, 怎么表示这种关系呢, 在注解后加标签dependsOnMethods 例如, 方法2就依赖于方法1, 如果方法1执行失败了, 方法2就无法执行了. package com.actiger.test.all; import org.testng.annotations.Test; public class Dependon{ @Test public void dependon1(){ System.out.println("dependon 1111111"); throw new RuntimeException(); } @Test(dependsOnMethods = {"dependon1"}) public void dependon2(){ System.out.println("dependon 2222222"); } } 2. TestNG的xml文件参数化 1.创建方法 package com.actiger.test.paramter; import org.testng.annotations.Parameters; import org.testng.annotations.Test; public class ParamterTest { @Test @Parameters({"name", "age"}) public void paramTest1(String name, int age){ System.out.println("Name:"+ name + ", " + "Age:" + age); } } 2....

TestNG异常测试

TestNG异常测试 1. expectedException方法预期RuntimeException异常 2. expectedSuccess方法预期RuntimeException异常 3. expectedException用例结果是失败的, expectedSuccess执行用例成功(预期与结果一致) package com.actiger.test.expectedException; import org.testng.annotations.Test; public class ExpectedExcepiton { @Test(expectedExceptions = RuntimeException.class) public void expectedException(){ System.out.println("期望运行异常的结果!"); } @Test(expectedExceptions = RuntimeException.class) public void expectedSuccess(){ System.out.println("期望运行异常的结果"); throw new RuntimeException(); } } ...

TestNG中注解Before After执行顺序

1. TestNG是什么 TestNG一种开源自动测试框架, 相当灵活的注解和配置, 自由测试. 2. Before After执行顺序 注解 描述 @BeforeSuite 套件, 在所有测试开始时运行1次 @BeforeTest 在所有类Classes前, BeforeSuite后运行1次,注解的方法将在testNG.xml文件test标签内的所有类方法运行前执行 @BeforeClass 在单个class类前执行1次 @BeforeGroups 在所有配置方法组前运行1次 @BeforeMethod 在单个配置方法前运行 @AfterMethod 在单个配置方法后运行 @AfterGroups 在所有配置方法组后运行1次 @AfterClass 在单个class类后执行1次 @AfterTest 在所有类Classes后, AfterSuite前运行1次, 注解的方法将在testNG.xml文件test标签内的所有类方法运行后执行。 @AfterSuite 套件, 在所有测试结束时运行1次 package com.actiger.test.suite; import org.testng.annotations.*; public class LoginTest { @Test(groups = {"group"}) public void loginTest(){ System....

Kubernetes Mariadb Mysql

1. 创建一个对外可使用的数据库, 外部网络访问使用NodePort. pod使用到PV,PVC, Secret. 2. 使用PV和PVC创建硬盘, PersistentVolume持久卷, 持久卷申请. 创建持久卷 pv-maria.yaml, 这里在node节点上申请hostPath申请空间 apiVersion: v1 kind: PersistentVolume metadata: name: pv-hostpath spec: capacity: storage: 300Mi accessModes: - ReadWriteOnce hostPath: path: "/root/mariadb" 创建持久卷申请pvc-maria.yaml, 申请容量与PV一致才会绑定成功. apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-hostpath spec: accessModes: - ReadWriteOnce storageClassName: "" resources: requests: storage: 200Mi 3. 为数据库root密码创建Secret文件mariapass.yml. root密码需要base64转换. apiVersion: v1 kind: Secret metadata: name: mariapass type: Opaque data: password: <base64加密你的root密码> username: cm9vdA== 4....