Skip to content

Distinguish between unit and integration tests repository should build by default #18

Open
@ManuelB

Description

@ManuelB

Hi,
I just cloned your repository and made the following experience:

git clone https://github.com/gengo/gengo-java.git
cd gengo-java/
mvn install
...
[INFO] Surefire report directory: /Users/manuel/Projects/gengo-java/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.gengo.client.AccountTest
Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.194 sec <<< FAILURE!
Running com.gengo.client.JobsTest
Tests run: 3, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.038 sec <<< FAILURE!
Running com.gengo.client.OrderTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.004 sec <<< FAILURE!
Running com.gengo.client.ServiceTest
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.015 sec <<< FAILURE!

Results :

Tests in error: 
  testGetAccountStats(com.gengo.client.AccountTest): This API requires authentication. Both a public and private key must be specified.
  testGetAccountPreferredTranslators(com.gengo.client.AccountTest): This API requires authentication. Both a public and private key must be specified.
  testGetAccountBalance(com.gengo.client.AccountTest): This API requires authentication. Both a public and private key must be specified.
  testPostJobsFiles(com.gengo.client.JobsTest): HTTP POST failed
  testPostJobsText(com.gengo.client.JobsTest): This API requires authentication. Both a public and private key must be specified.
  testGetOrder(com.gengo.client.OrderTest): This API requires authentication. Both a public and private key must be specified.
  testGetServiceLanguagePairs(com.gengo.client.ServiceTest): This API requires authentication. Both a public and private key must be specified.
  testGetServiceLanguages(com.gengo.client.ServiceTest): This API requires authentication. Both a public and private key must be specified.

Tests run: 9, Failures: 0, Errors: 8, Skipped: 0
...

So directly building the source code does not work because test cases are failing.

I would recommend to distinguish between unit tests and integration tests. A unit test mocks all integrations and does not need any external system. You might want to use the following project to convert your current tests to real unit tests:

https://github.com/ManuelB/mockito-caching-spy

Further you can have integration tests which are only executed during releasing the software.

To solve the problem I did:

mvn -DskipTests=true install

Hope that helps
Manuel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions