Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

TestNG tests run locally but not in bitbucket pipelines

Hello :)
I'm facing a problem with maven and testNG tests. I have a maven project for UI tests and I use selenium and testNG. I also have a testng.xml. 

All I do on the terminal is "mvn clean test" and they all run okay.

My bitbucket-pipelines.yml:

image: atlassian/default-image:2
pipelines:
branches:
feature/*:
-
step:
script:
- mvn --version

- apt-get update

- apt-get upgrade -y

- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

- yes | apt-get install ./google-chrome-stable_current_amd64.deb -f

- apt-get install -y testng

- mvn clean test

The "mvn clean test" runs properly until it gets messed up with the "@BeforeClass, @AfterClass, etc", methods... It seems like it replicates them because it has no notion of the testng.xml file.

I tried to run the testng.xml but no success at all...

What might this be? Thanks.

 

2 answers

Hi Patricia,

Here's a sample bitbucket-pipelines.yml file I use normally in my Selenium Projects, hope it helps.

image: atlassian/default-image:2
pipelines:
branches:
master:
- step:
name: 'Selenium Test - Chrome'
script:
- mvn clean test
services:
- chrome
caches:
- maven
definitions:
services:
chrome:
image: selenium/standalone-chrome

Using different images and services instead of downloading and installing software in flight will save you also some time

EDIT:
The selenium for chrome will open a RemoteURL , so make sure your WebDriver contains the remote URL.


URL remoteURL = new URL("http://localhost:4444/wd/hub");

driver = new RemoteWebDriver(remoteURL, chromeOptions);
0 votes

Please let me know if you got to resolve this issue, thanks

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

⭐ Calling all Bitbucket and DevOps experts: Special showcase opportunity ⭐

Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...

1,497 views 4 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you