2016-06-02 16 views

Antwort

1

Hallo TestNG als

1. TestNG is a testing framework designed to simplify a broad range of testing needs, from unit testing (testing a class in isolation of the others) to integration testing (testing entire systems made of several classes, several packages and even several external frameworks, such as application servers).

2.Bei offiziellen TestNG Dokumentation Please Click Here

definiert werden, bevor Sie TestNG mit Selen verwenden, können Sie es first.Talking installieren müssen in Berücksichtigung, dass Sie mit Eclipse arbeiten (jede Version)

1. There are various ways to install TestNG either followthis oder thisor simply go to Help/Eclipse MarketPlace. under Find type Test NG and click on the install

jetzt, wie Test-NG mit Selen in Eclipse verwenden

@BeforeTest 
    public void TearUP(){ 
     // preconditions for sample test 
     // like browser start with specific URL 
    } 


@Test 
    public void SampleTest(){ 
     // code for the main test case goes inside 
    } 

@AfterTest 
public void TearDown1(){ 
    // thing to done after test is run 
    // like memory realese 
    // browser close 

} 

Einige Informationen für obigen Code

  1. TestNG haben verschiedene Anmerkungen für weitere Informationen auf Anmerkung zu dem oben gehen link

    @BeforeSuite: Die annotierte Methode wird ausgeführt, bevor alle Tests in dieser Suite ausgeführt wurden.

    @AfterSuite: The annotated method will be run after all tests in this suite have run. 
    @BeforeTest: The annotated method will be run before any test method belonging to the classes inside the <test> tag is run. 
    @AfterTest: The annotated method will be run after all the test methods belonging to the classes inside the <test> tag have run. 
    @BeforeGroups: The list of groups that this configuration method will run before. This method is guaranteed to run shortly before the first test method that belongs to any of these groups is invoked. 
    @AfterGroups: The list of groups that this configuration method will run after. This method is guaranteed to run shortly after the last test method that belongs to any of these groups is invoked. 
    @BeforeClass: The annotated method will be run before the first test method in the current class is invoked. 
    @AfterClass: The annotated method will be run after all the test methods in the current class have been run. 
    @BeforeMethod: The annotated method will be run before each test method. 
    @AfterMethod: The annotated method will be run after each test method. 
    
1

Eine der primären Verwendung von Selen ist, um die ui-Funktionalität zu testen, und als Test-Framework testNg hat viele Techniken zu laufen und die Tests zu melden und kann für den Test mit Selen genutzt werden. Eines der Tools, die dies effektiv nutzen, ist selion (https://github.com/paypal/selion).

Verwandte Themen