MyEclipse Instructions for use (White box black box, JUnit)

Source: Internet
Author: User
Tags assert

1, MyEclipse

1), first configuration workspace, it is recommended not to use space and Chinese, all the source code is only workspace in the existence of.

2), new Project (project), set up the JRE environment required for the project,

The MyEclipse has a variety of layouts---each layout interface is different and the menus differ.

3), Project properties:

Encoding set----must be unified code, especially when you import other projects, note that the code must be consistent.

Java biuld Path---Sets the location of the classpath, specifying the class library referenced by the current project

The source----Specifies the location where the. java files and. class files are stored.

Libraries----Specifying the class library referenced by the current project

Java Compiler---Specify a compiled version, note that the compilation version must be lower than the running environment version

3), grouping existing projects: Working set

Hide projects that you don't want to use by grouping

4), shortcut keys:

alt+/Content Tips

Ctrl+1 Quick Fix

Ctrl+shift+o Guide Bag

Ctrl+shift+f formatting

CTRL (SHIFT) +/comments

ALT + up and down key to move code

5), breakpoint debugging:

F5 (jumping in: jumping into a method--looking at the running process in more detail)

F7 (jumping out: jumping out of a method)

F6 (skipped--a line of execution code)

2, about the Code test-----White box test and black box test

White-Box testing is a test of code structure and logic (visible code testing), Black-box testing is a test of code functionality and performance (invisible Code testing)

White Box Test Limitations * * *

1), impossible to test all code

2), test difficulty is higher-----white box test to the software engineer himself

The monomer test is a white-box test that tests the Code function module---a single function of the test code


JUnit is a single test technique for Java.

1), first quoted JUnit class library in engineering

2), write the monomer test case:

Format:

Write a method in the class: the type must be void, the argument is empty, the access modifier is public, and the method is @test

@Test

public void Test () {}

3), now each test method is equivalent to the previous write a main method, each test method can be executed separately---Check the method name,

Right click on Run to OK.

When using JUnit testing, if there are many ways to output the results of each method to the console, one cannot clearly determine whether the result is

Correct, this time to use the-----automated results Check,--Assert assert

Assertion principle: Call the method, prepare the test data before invoking the method, prepare the test data for the running result, and compare the actual results and

The expected results are the same.

When writing a single test, do not test only the correct results, but also test for incorrect data (including illegal data)

For details, refer to this example:

e:\java\workplace_myeclipse\day01\day01\src\calculatortest.java***

MyEclipse Instructions for use (White box black box, JUnit)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.