在Eclipse Juno中使用Testng

时间:2014-05-30 16:13:38

标签: eclipse testng eclipse-juno

我正在使用Eclipse Juno。我正确安装了TestNG插件。但是当我想运行测试时,我无法在运行方式中找到TestNG选项。怎么了?

我的班级

package com.oasisdigital.rental.client;

import static javax.ws.rs.core.Response.Status.CREATED;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import javax.ws.rs.core.Response;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import com.oasisdigital.rental.test.AbstractIT;

@Test
public class ClientResourceIT extends AbstractIT {

    private ClientApi clientApi;

    @Override
    @BeforeMethod
    public void setUp() {
        super.setUp();

        this.clientApi = new ClientApi(api);
    }

    @Test
    public void shouldReturnEmptyListWhenNoProviders() {
        assertThat(clientApi.getClients(), is(empty()));
    }

    @Test
    public void shouldReturnClientAfterCreation() {
        Response resp = clientApi.postClient("Jimmy");
        assertThat(resp.getStatus(), is(CREATED.getStatusCode()));

        ClientDto client = resp.readEntity(ClientDto.class);
        assertThat(client.getId(), is(notNullValue()));
        assertThat(client.getName(), is("Jimmy"));

        assertThat(clientApi.getClients(), contains(client));
    }
}

0 个答案:

没有答案