• 运行插桩
    1.命令

    2.结果

  • 课间作业:
    Maven统计覆盖率--

    IDEA统计覆盖率

  • public class TestJunit4DemoTwo extends TestJunit4Father {

    @BeforeClass
    public static void beforeClassDemoTwo(){
    System.out.println("test-beforeClassDemoTwo");
    }

    @AfterClass
    public static void afterClassDemoTwo(){
    System.out.println("test-afterClassDemoTwo");
    }

    @Before
    public void beforeDemoTwo(){
    System.out.println("test-beforeDemoTwo");
    }

    @After
    public void afterDemoTwo(){
    System.out.println("test-afterDemoTwo");
    }

    @Test
    public void testB1(){
    System.out.println("test--testB1");
    }

    @Test
    public void testB2(){
    System.out.println("test-testB2");
    }

    }

    public class TestJunit4Father {

    @BeforeClass
    public static void parentBeforeClassDemo(){
    System.out.println("test-parentBeforeClassDemo");
    }

    @AfterClass
    public static void parentAfterClassDemo(){
    System.out.println("test-parentAfterClassDemo");
    }

    @Before
    public void parentBeforeDemo(){
    System.out.println("test-parentBeforeDemo1");
    }

    @After
    public void parentAfterDemo(){
    System.out.println("test-parentAfterDemo1");
    }

    }
  • 作业1:
    1.使用自动化脚本,进行业务模拟。
    2.发现两个异常进行启动。

    作业2:
    Appetizer+Maxim:

    Crash:

  • public void decodeDemo1() {
    given().filter((req, res, ctx) -> {
    Response resOrigin = ctx.next(req, res);
    BASE64Decoder decoder = new BASE64Decoder();
    byte[] bytes = new byte[0];
    try {
    bytes = decoder.decodeBuffer(resOrigin.body().asString());
    } catch (IOException e) {
    e.printStackTrace();
    }
    ResponseBuilder responseBuilder = new ResponseBuilder().clone(resOrigin);
    responseBuilder.setBody(new String(bytes));
    return responseBuilder.build();
    })
    .when().log().all()
    .get("http://101.132.159.87:8080/user.json")
    .then()
    .log().all().
    body("errcode", equalTo(0));
    }
  • 课后作业:


  • 占领一号坑

  • 作业1

    作业2

    import io.restassured.http.ContentType;
    import org.apache.commons.lang3.RandomStringUtils;
    import org.junit.Before;
    import org.junit.Test;
    import java.util.HashMap;

    import static io.restassured.RestAssured.given;
    import static org.hamcrest.Matchers.equalTo;


    public class testDemo {
    public static String token;

    @Before
    public void getToken(){
    String baseURI = "https://qyapi.weixin.qq.com/cgi-bin/gettoken";
    token = given()
    .queryParam("corpid","")
    .queryParam("corpsecret","9FsyGoQe6dPKvS7anxq3vfDf--Jx9_Q")
    .when()
    .get(baseURI)
    .then()
    .statusCode(200)
    .body("errcode", equalTo(0))
    .extract().body().path("access_token");
    }
    @Test
    public void createDepartment(){
    String url = "https://qyapi.weixin.qq.com/cgi-bin/department/create";
    String name = RandomStringUtils.random(3, "abcdefgABCDEFG");
    HashMap<String, Object> data = new HashMap<String, Object>();
    data.put("name", name);
    data.put("parentid", "1");
    given()
    .queryParam("access_token", token)
    .contentType(ContentType.JSON)
    .body(data)
    .when()
    .post(url)
    .then()
    .log().all()
    .body("errcode",equalTo(0));
    }
    }

    作业3:
    Java实在是不行,还在提高中,会补上。
    2020.1.15
    https://github.com/goodBoyEric/testInterface

  • 手动测试启动时间
    1、
    sagit:/ $ pm list package | grep UC
    package:com.UCMobile
    2、
    sagit:/ $ logcat | grep Displayed
    12-27 15:52:32.981 1447 1581 I ActivityManager: Displayed com.UCMobile/com.uc.browser.InnerUCMobile: +68ms (total +367ms)
    3、
    sagit:/ $ pm clear com.UCMobile
    Success
    sagit:/ $ am force-stop com.UCMobile
    sagit:/ $ am start -S -W com.UCMobile/com.uc.browser.InnerUCMobile
    Stopping: com.UCMobile
    Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.UCMobile/com.uc.browser.InnerUCMobile }
    Status: ok
    Activity: com.UCMobile/com.uc.browser.InnerUCMobile
    ThisTime: 480
    TotalTime: 480
    WaitTime: 520
    Complete

    作业1:

    作业2:

  • 我中有我,我将无我