How to use fixture_3 method in Slash

Best Python code snippet using slash

tests.py

Source:tests.py Github

copy

Full Screen

1import json2import random3from django.utils import timezone4from django.core.urlresolvers import reverse5from django.test import TestCase6from rest_framework import status7from rest_framework.test import APITestCase8from rest_framework.authtoken.models import Token9from games.factories import * # Circular10from .factories import *11class TournamentAPITest(APITestCase):12 def test_get_200_OK(self):13 tournament_1 = TournamentFactory()14 tournament_2 = TournamentFactory()15 player = PlayerFactory()16 token = Token.objects.get(user__username = player.username)17 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)18 url = reverse('tournamentList')19 response = self.client.get(url)20 r_tournaments = json.loads(response.content)21 self.assertEqual(len(r_tournaments), 2)22 self.assertEqual(r_tournaments[0]['name'], tournament_1.name)23 self.assertEqual(response.status_code, status.HTTP_200_OK)24 def test_get_401_UNAUTHORIZED(self):25 tournament_1 = TournamentFactory()26 url = reverse('tournamentList')27 response = self.client.get(url)28 self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)29 def test_get_tournament_with_teams_200_OK(self):30 # Tournament31 tournament = TournamentFactory()32 fixture = FixtureFactory(tournament = tournament)33 team_1 = TeamFactory()34 team_2 = TeamFactory()35 tournament.teams.add(team_1)36 tournament.teams.add(team_2) 37 match = MatchFactory(local_team = team_1, visitor_team = team_2, fixture = fixture)38 # Player39 player = PlayerFactory()40 token = Token.objects.get(user__username = player.username)41 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)42 # Player asks for the tournament43 url = reverse('tournamentTeamsList')44 response = self.client.get(url)45 self.assertEqual(response.status_code, status.HTTP_200_OK)46 self.assertEqual(len(response.data[0]['teams']), 2)47 def test_get_401_UNAUTHORIZED(self):48 tournament_1 = TournamentFactory()49 url = reverse('tournamentTeamsList')50 response = self.client.get(url)51 self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED) 52 def test_get_tournament_with_teams_stats_200_OK(self):53 # Tournament54 tournament = TournamentFactory()55 fixture = FixtureFactory(tournament = tournament)56 local_team = TeamFactory()57 visitor_team = TeamFactory() 58 tournament.teams.add(local_team)59 tournament.teams.add(visitor_team) 60 match = MatchFactory(local_team = local_team, visitor_team = visitor_team,61 fixture = fixture, is_finished = True,62 local_team_goals = 1, visitor_team_goals = 0)63 64 # Player65 player = PlayerFactory()66 token = Token.objects.get(user__username = player.username)67 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)68 # Player asks for the tournament with stats69 url = reverse('tournamentStats', kwargs = {'pk': tournament.id }) 70 response = self.client.get(url)71 72 self.assertEqual(response.status_code, status.HTTP_200_OK)73 teams = response.data['teams']74 # Order by ID reverse75 team = teams[1]76 self.assertEqual(team['stats']['w'], 0)77 self.assertEqual(team['stats']['d'], 0)78 self.assertEqual(team['stats']['l'], 1)79 team = teams[0]80 self.assertEqual(team['stats']['w'], 1)81 self.assertEqual(team['stats']['d'], 0)82 self.assertEqual(team['stats']['l'], 0) 83 def test_get_tournament_with_teams_stats_401_UNAUTHORIZED(self):84 tournament = TournamentFactory()85 url = reverse('tournamentStats', kwargs = {'pk': tournament.id }) 86 response = self.client.get(url)87 self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)88class TournamentFixtureAPITest(APITestCase):89 def test_get_tournament_fixtures_200_OK(self):90 # Tournament91 tournament = TournamentFactory()92 fixture_1 = FixtureFactory(tournament = tournament, number = 0)93 fixture_2 = FixtureFactory(tournament = tournament, number = 1)94 fixture_3 = FixtureFactory(tournament = tournament, number = 2)95 # Player96 player = PlayerFactory()97 token = Token.objects.get(user__username = player.username)98 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)99 # Player gets Tournament Fixture100 url = reverse('tournamentAllFixtures', kwargs = {'pk': tournament.id })101 response = self.client.get(url)102 # Assert103 self.assertEqual(len(response.data['fixtures']), 3)104 self.assertEqual(response.data['fixtures'][0]['number'], fixture_1.number)105 self.assertEqual(response.data['fixtures'][1]['number'], fixture_2.number)106 self.assertEqual(response.data['fixtures'][2]['number'], fixture_3.number)107 self.assertEqual(response.status_code, status.HTTP_200_OK)108 def test_get_multiples_tournament_fixtures_200_OK(self):109 """110 We test from multiples tournaments to see111 if the filters works112 """113 # Tournament114 tournament = TournamentFactory()115 fixture_1 = FixtureFactory(tournament = tournament, number = 0)116 fixture_2 = FixtureFactory(tournament = tournament, number = 1)117 fixture_3 = FixtureFactory(tournament = tournament, number = 2)118 # Tournament B119 tournament_b = TournamentFactory()120 FixtureFactory(tournament = tournament_b, number = 0)121 FixtureFactory(tournament = tournament_b, number = 1)122 # Tournament C123 tournament_c = TournamentFactory()124 FixtureFactory(tournament = tournament_c, number = 0)125 # Player126 player = PlayerFactory()127 token = Token.objects.get(user__username = player.username)128 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)129 # Tournament A130 # Player gets Tournament Fixture131 url = reverse('tournamentAllFixtures', kwargs = {'pk': tournament.id })132 response = self.client.get(url)133 # Assert134 self.assertEqual(response.status_code, status.HTTP_200_OK)135 self.assertEqual(len(response.data['fixtures']), 3)136 self.assertEqual(response.data['fixtures'][0]['number'], fixture_1.number)137 self.assertEqual(response.data['fixtures'][1]['number'], fixture_2.number)138 self.assertEqual(response.data['fixtures'][2]['number'], fixture_3.number)139 # Tournament B140 # Player gets Tournament Fixture141 url = reverse('tournamentAllFixtures', kwargs = {'pk': tournament_b.id })142 response = self.client.get(url)143 # Assert144 self.assertEqual(response.status_code, status.HTTP_200_OK)145 self.assertEqual(len(response.data['fixtures']), 2)146 # Tournament C147 # Player gets Tournament Fixture148 url = reverse('tournamentAllFixtures', kwargs = {'pk': tournament_c.id })149 response = self.client.get(url)150 # Assert151 self.assertEqual(response.status_code, status.HTTP_200_OK)152 self.assertEqual(len(response.data['fixtures']), 1)153 def test_get_empty_fixture_from_unexesting_tournament_404_NOT_FOUND(self):154 # Tournament155 tournament = TournamentFactory()156 fixture_1 = FixtureFactory(tournament = tournament, number = 0)157 # Player158 player = PlayerFactory()159 token = Token.objects.get(user__username = player.username)160 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)161 # Player gets Tournament Fixture162 url = reverse('tournamentAllFixtures', kwargs = {'pk': tournament.id + 1 })163 response = self.client.get(url)164 # Assert165 self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)166 def test_anon_gets_fixture_401_UNAUTHORIZED(self):167 # Tournament168 tournament = TournamentFactory()169 fixture_1 = FixtureFactory(tournament = tournament, number = 0)170 # Player gets Tournament Fixture171 url = reverse('tournamentAllFixtures', kwargs = {'pk': tournament.id })172 response = self.client.get(url)173 # Assert174 self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)175 def test_get_fixture_ordered_by_number(self):176 # Tournament177 tournament = TournamentFactory()178 fixture_3 = FixtureFactory(tournament = tournament, number = 2)179 fixture_2 = FixtureFactory(tournament = tournament, number = 1)180 fixture_1 = FixtureFactory(tournament = tournament, number = 0)181 # Player182 player = PlayerFactory()183 token = Token.objects.get(user__username = player.username)184 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)185 # Player gets Tournament Fixture186 url = reverse('tournamentAllFixtures', kwargs = {'pk': tournament.id })187 response = self.client.get(url)188 # Asset189 self.assertEqual(response.status_code, status.HTTP_200_OK)190 self.assertEqual(response.data['fixtures'][0]['number'], fixture_1.number)191 self.assertEqual(response.data['fixtures'][1]['number'], fixture_2.number)192 self.assertEqual(response.data['fixtures'][2]['number'], fixture_3.number)193 def test_get_fixture_with_current_fixture_A(self):194 # Tournament195 tournament = TournamentFactory()196 fixture_1 = FixtureFactory(tournament = tournament, number = 0)197 fixture_2 = FixtureFactory(tournament = tournament, number = 1)198 fixture_3 = FixtureFactory(tournament = tournament, number = 2)199 # Player200 player = PlayerFactory()201 token = Token.objects.get(user__username = player.username)202 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)203 # Player gets Tournament Fixture204 url = reverse('tournamentAllFixtures', kwargs = {'pk': tournament.id })205 response = self.client.get(url)206 # Asset207 self.assertEqual(response.status_code, status.HTTP_200_OK)208 self.assertEqual(response.data['current_fixture']['number'], fixture_1.number)209 self.assertFalse(response.data['is_finished'])210 def test_get_fixture_with_current_fixture_B(self):211 # Tournament212 tournament = TournamentFactory()213 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_finished = True)214 fixture_2 = FixtureFactory(tournament = tournament, number = 1)215 fixture_3 = FixtureFactory(tournament = tournament, number = 2)216 # Player217 player = PlayerFactory()218 token = Token.objects.get(user__username = player.username)219 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)220 # Player gets Tournament Fixture221 url = reverse('tournamentAllFixtures', kwargs = {'pk': tournament.id })222 response = self.client.get(url)223 # Asset224 self.assertEqual(response.status_code, status.HTTP_200_OK)225 self.assertEqual(response.data['current_fixture']['number'], fixture_2.number)226 self.assertFalse(response.data['is_finished'])227 def test_get_fixture_with_current_fixture_C(self):228 # Tournament229 tournament = TournamentFactory()230 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_finished = True)231 fixture_2 = FixtureFactory(tournament = tournament, number = 1, is_finished = True)232 fixture_3 = FixtureFactory(tournament = tournament, number = 2)233 # Player234 player = PlayerFactory()235 token = Token.objects.get(user__username = player.username)236 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)237 # Player gets Tournament Fixture238 url = reverse('tournamentAllFixtures', kwargs = {'pk': tournament.id })239 response = self.client.get(url)240 # Asset241 self.assertEqual(response.status_code, status.HTTP_200_OK)242 self.assertEqual(response.data['current_fixture']['number'], fixture_3.number)243 self.assertFalse(response.data['is_finished'])244 def test_get_tournament_finished(self):245 # Tournament246 tournament = TournamentFactory(is_finished = True)247 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_finished = True)248 # Player249 player = PlayerFactory()250 token = Token.objects.get(user__username = player.username)251 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)252 # Player gets Tournament Fixture253 url = reverse('tournamentAllFixtures', kwargs = {'pk': tournament.id })254 response = self.client.get(url)255 # Asset256 self.assertEqual(response.status_code, status.HTTP_200_OK)257 self.assertEqual(response.data['current_fixture'], None)258 self.assertTrue(response.data['is_finished'])259 def test_get_fixture_with_matches(self):260 # Tournament261 tournament = TournamentFactory()262 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_finished = True)263 MatchFactory(fixture = fixture_1)264 MatchFactory(fixture = fixture_1)265 MatchFactory(fixture = fixture_1)266 fixture_2 = FixtureFactory(tournament = tournament, number = 1, is_finished = True)267 MatchFactory(fixture = fixture_2)268 MatchFactory(fixture = fixture_2)269 fixture_3 = FixtureFactory(tournament = tournament, number = 2)270 MatchFactory(fixture = fixture_3)271 # Player272 player = PlayerFactory()273 token = Token.objects.get(user__username = player.username)274 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)275 # Player gets Tournament Fixture276 url = reverse('tournamentAllFixtures', kwargs = {'pk': tournament.id })277 response = self.client.get(url)278 # Asset279 self.assertEqual(response.status_code, status.HTTP_200_OK)280 self.assertEqual(len(response.data['fixtures'][0]['matches']), 3)281 self.assertEqual(len(response.data['fixtures'][1]['matches']), 2)282 self.assertEqual(len(response.data['fixtures'][2]['matches']), 1)283 def test_get_fixture_with_detailed_matches(self):284 # Tournament285 tournament = TournamentFactory()286 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_finished = True)287 match_1 = MatchFactory(fixture = fixture_1)288 match_2 = MatchFactory(fixture = fixture_1)289 match_3 = MatchFactory(fixture = fixture_1)290 # Player291 player = PlayerFactory()292 token = Token.objects.get(user__username = player.username)293 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)294 # Player gets Tournament Fixture295 url = reverse('tournamentAllFixtures', kwargs = {'pk': tournament.id })296 response = self.client.get(url)297 # Assert298 self.assertEqual(response.status_code, status.HTTP_200_OK)299 self.assertEqual(len(response.data['fixtures'][0]['matches']), 3)300 self.assertEqual(response.data['fixtures'][0]['matches'][0]['date'], str(match_1.date))301 self.assertEqual(response.data['fixtures'][0]['matches'][0]['local_team']['name'], match_1.local_team.name)302 self.assertEqual(response.data['fixtures'][0]['matches'][0]['visitor_team']['name'], match_1.visitor_team.name)303 self.assertEqual(response.data['fixtures'][0]['matches'][1]['date'], str(match_2.date))304 self.assertEqual(response.data['fixtures'][0]['matches'][1]['local_team']['name'], match_2.local_team.name)305 self.assertEqual(response.data['fixtures'][0]['matches'][1]['visitor_team']['name'], match_2.visitor_team.name)306 self.assertEqual(response.data['fixtures'][0]['matches'][2]['date'], str(match_3.date))307 self.assertEqual(response.data['fixtures'][0]['matches'][2]['local_team']['name'], match_3.local_team.name)308 self.assertEqual(response.data['fixtures'][0]['matches'][2]['visitor_team']['name'], match_3.visitor_team.name)309 def test_get_fixture_with_finished_matches(self):310 # Tournament311 tournament = TournamentFactory()312 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_finished = True)313 match_1 = MatchFactory(fixture = fixture_1, is_finished = True)314 match_2 = MatchFactory(fixture = fixture_1)315 # Player316 player = PlayerFactory()317 token = Token.objects.get(user__username = player.username)318 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)319 # Player gets Tournament Fixture320 url = reverse('tournamentAllFixtures', kwargs = {'pk': tournament.id })321 response = self.client.get(url)322 # Assert323 self.assertEqual(response.status_code, status.HTTP_200_OK)324 self.assertTrue(response.data['fixtures'][0]['matches'][0]['is_finished'])325 self.assertFalse(response.data['fixtures'][0]['matches'][1]['is_finished'])326 def test_get_fixture_with_its_playing_info_A(self):327 # Tournament328 tournament = TournamentFactory()329 fixture = FixtureFactory(tournament = tournament, open_until = timezone.now())330 # Player331 player = PlayerFactory()332 token = Token.objects.get(user__username = player.username)333 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)334 # Player gets Tournament Fixture335 url = reverse('tournamentAllFixtures', kwargs = {'pk': tournament.id })336 response = self.client.get(url)337 # Asset338 self.assertEqual(response.status_code, status.HTTP_200_OK)339 self.assertTrue(response.data['fixtures'][0]['is_closed'])340 def test_get_fixture_with_its_playing_info_B(self):341 # Tournament342 tournament = TournamentFactory()343 fixture = FixtureFactory(tournament = tournament)344 345 # Player346 player = PlayerFactory()347 token = Token.objects.get(user__username = player.username)348 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)349 # Player gets Tournament Fixture350 url = reverse('tournamentAllFixtures', kwargs = {'pk': tournament.id })351 response = self.client.get(url)352 # Asset353 self.assertEqual(response.status_code, status.HTTP_200_OK)354 self.assertFalse(response.data['fixtures'][0]['is_closed'])355 def test_get_tournaments_next_fixture_200_OK_A(self):356 """357 We get next fixture from all the tournaments of the site.358 Tournaments: 1359 Tournament only has one Fixture. Next is None.360 """361 # Tournament362 tournament = TournamentFactory()363 fixture_1 = FixtureFactory(tournament = tournament, number = 0)364 # Player365 player = PlayerFactory()366 token = Token.objects.get(user__username = player.username)367 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)368 # Player gets from All the Tournaments the Current Fixture369 url = reverse('allTournamentNextFixtureList')370 response = self.client.get(url)371 # Assert372 self.assertEqual(response.status_code, status.HTTP_200_OK) 373 self.assertEqual(len(response.data), 1)374 self.assertEqual(response.data[0]['fixture'], None) 375 def test_get_tournaments_next_fixture_200_OK_B(self):376 """377 We get next fixture from all the tournaments of the site.378 Tournaments: 1379 Tournament has began. Next fixture is fixture_2380 """ 381 # Tournament382 tournament = TournamentFactory()383 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_finished = True)384 fixture_2 = FixtureFactory(tournament = tournament, number = 1)385 fixture_3 = FixtureFactory(tournament = tournament, number = 2)386 # Player387 player = PlayerFactory()388 token = Token.objects.get(user__username = player.username)389 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)390 # Player gets from All the Tournaments the Next Fixture391 url = reverse('allTournamentNextFixtureList')392 response = self.client.get(url)393 # Assert394 self.assertEqual(response.status_code, status.HTTP_200_OK) 395 self.assertEqual(len(response.data), 1)396 self.assertEqual(response.data[0]['tournament_name'], tournament.name)397 self.assertEqual(response.data[0]['fixture']['number'], fixture_2.number)398 def test_get_tournaments_next_fixture_200_OK_C(self):399 """400 We get next fixture from all the tournaments of the site.401 Tournaments: 1402 Tournament has began. Next fixture is fixture_3403 """ 404 # Tournament405 tournament = TournamentFactory()406 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_finished = True)407 fixture_2 = FixtureFactory(tournament = tournament, number = 1, is_finished = True)408 fixture_3 = FixtureFactory(tournament = tournament, number = 2)409 # Player410 player = PlayerFactory()411 token = Token.objects.get(user__username = player.username)412 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)413 # Player gets from All the Tournaments the Next Fixture414 url = reverse('allTournamentNextFixtureList')415 response = self.client.get(url)416 # Assert417 self.assertEqual(response.status_code, status.HTTP_200_OK) 418 self.assertEqual(len(response.data), 1)419 self.assertEqual(response.data[0]['tournament_name'], tournament.name)420 self.assertEqual(response.data[0]['fixture']['number'], fixture_3.number)421 def test_get_tournaments_next_fixture_200_OK_D(self):422 """423 We get next fixture from all the tournaments of the site.424 Tournaments: 1425 Tournament has finished. There are no more fixtures to be play.426 """ 427 # Tournament428 tournament = TournamentFactory(is_finished = True)429 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_finished = True)430 # Player431 player = PlayerFactory()432 token = Token.objects.get(user__username = player.username)433 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)434 # Player gets from All the Tournaments the Next Fixture435 url = reverse('allTournamentNextFixtureList')436 response = self.client.get(url)437 # Assert438 self.assertEqual(response.status_code, status.HTTP_200_OK) 439 self.assertEqual(len(response.data), 0)440 def test_get_tournaments_next_fixture_200_OK_E(self):441 """442 We get next fixture from all the tournaments of the site.443 Tournaments: 3444 """ 445 # Tournament446 tournament = TournamentFactory()447 FixtureFactory(tournament = tournament, is_finished = True, number = 1)448 FixtureFactory(tournament = tournament, number = 2) 449 # Tournament B450 tournament_b = TournamentFactory()451 FixtureFactory(tournament = tournament_b, is_finished = True, number = 3 ) 452 FixtureFactory(tournament = tournament_b, number = 4)453 # Tournament C454 tournament_c = TournamentFactory()455 FixtureFactory(tournament = tournament_c, is_finished = True, number = 5 ) 456 FixtureFactory(tournament = tournament_c, number = 6)457 # Player458 player = PlayerFactory()459 token = Token.objects.get(user__username = player.username)460 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)461 # Tournament A462 # Player gets Tournament Fixture463 url = reverse('allTournamentNextFixtureList')464 response = self.client.get(url)465 # Assert466 self.assertEqual(response.status_code, status.HTTP_200_OK)467 self.assertEqual(len(response.data), 3)468 self.assertEqual(response.data[0]['tournament_name'], tournament.name)469 self.assertEqual(response.data[0]['fixture']['number'], 2)470 471 self.assertEqual(response.data[1]['tournament_name'], tournament_b.name)472 self.assertEqual(response.data[1]['fixture']['number'], 4)473 474 self.assertEqual(response.data[2]['tournament_name'], tournament_c.name)475 self.assertEqual(response.data[2]['fixture']['number'], 6)476 def test_get_tournaments_next_fixture_200_OK_F(self):477 """478 We get next fixture from all the tournaments of the site.479 Tournaments: 1480 Tournament isn't started. Next fixture is fixture_2.481 This is an exception to the rule.482 """483 # Tournament484 tournament = TournamentFactory()485 fixture_1 = FixtureFactory(tournament = tournament, number = 0)486 fixture_2 = FixtureFactory(tournament = tournament, number = 1)487 fixture_3 = FixtureFactory(tournament = tournament, number = 2)488 # Player489 player = PlayerFactory()490 token = Token.objects.get(user__username = player.username)491 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)492 # Player gets from All the Tournaments the Next Fixture493 url = reverse('allTournamentNextFixtureList')494 response = self.client.get(url)495 # Assert496 self.assertEqual(response.status_code, status.HTTP_200_OK) 497 self.assertEqual(len(response.data), 1)498 self.assertEqual(response.data[0]['tournament_name'], tournament.name)499 self.assertEqual(response.data[0]['fixture']['number'], fixture_2.number)500 def test_get_tournaments_next_fixture_when_there_is_one_playing_200_OK_A(self):501 """502 We get next fixture from all the tournaments of the site.503 Tournaments: 1504 If a fixture is being played we get the next one.505 """506 # Tournament507 tournament = TournamentFactory()508 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_playing = True)509 fixture_2 = FixtureFactory(tournament = tournament, number = 1)510 fixture_3 = FixtureFactory(tournament = tournament, number = 2)511 # Player512 player = PlayerFactory()513 token = Token.objects.get(user__username = player.username)514 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)515 # Player gets from All the Tournaments the Next Fixture516 url = reverse('allTournamentNextFixtureList')517 response = self.client.get(url)518 # Assert519 self.assertEqual(response.status_code, status.HTTP_200_OK) 520 self.assertEqual(len(response.data), 1)521 self.assertEqual(response.data[0]['tournament_name'], tournament.name)522 self.assertEqual(response.data[0]['fixture']['number'], fixture_2.number)523 def test_get_tournaments_next_fixture_when_there_is_one_playing_200_OK_B(self):524 """525 We get next fixture from all the tournaments of the site.526 Tournaments: 1527 If a fixture is being played we get the next one.528 """529 # Tournament530 tournament = TournamentFactory()531 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_finished = True)532 fixture_2 = FixtureFactory(tournament = tournament, number = 1, is_playing = True)533 fixture_3 = FixtureFactory(tournament = tournament, number = 2)534 # Player535 player = PlayerFactory()536 token = Token.objects.get(user__username = player.username)537 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)538 # Player gets from All the Tournaments the Next Fixture539 url = reverse('allTournamentNextFixtureList')540 response = self.client.get(url)541 # Assert542 self.assertEqual(response.status_code, status.HTTP_200_OK) 543 self.assertEqual(len(response.data), 1)544 self.assertEqual(response.data[0]['tournament_name'], tournament.name)545 self.assertEqual(response.data[0]['fixture']['number'], fixture_3.number) 546 def test_get_tournaments_next_fixture_when_there_is_one_playing_200_OK_C(self):547 """548 We get next fixture from all the tournaments of the site.549 Tournaments: 1550 If a fixture is being played we get the next one.551 """552 # Tournament553 tournament = TournamentFactory()554 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_finished = True)555 fixture_2 = FixtureFactory(tournament = tournament, number = 1, is_playing = True, is_finished = True)556 fixture_3 = FixtureFactory(tournament = tournament, number = 2)557 # Player558 player = PlayerFactory()559 token = Token.objects.get(user__username = player.username)560 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)561 # Player gets from All the Tournaments the Next Fixture562 url = reverse('allTournamentNextFixtureList')563 response = self.client.get(url)564 # Assert565 self.assertEqual(response.status_code, status.HTTP_200_OK) 566 self.assertEqual(len(response.data), 1)567 self.assertEqual(response.data[0]['tournament_name'], tournament.name)568 self.assertEqual(response.data[0]['fixture']['number'], fixture_3.number)569 def test_get_tournaments_next_fixture_when_there_is_one_playing_200_OK_D(self):570 """571 We get next fixture from all the tournaments of the site.572 Tournaments: 1573 Tournament is playing his last fixture. 574 """575 # Tournament576 tournament = TournamentFactory()577 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_finished = True)578 fixture_2 = FixtureFactory(tournament = tournament, number = 1, is_playing = True, is_finished = True)579 fixture_3 = FixtureFactory(tournament = tournament, number = 2, is_playing = True)580 # Player581 player = PlayerFactory()582 token = Token.objects.get(user__username = player.username)583 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)584 # Player gets from All the Tournaments the Next Fixture585 url = reverse('allTournamentNextFixtureList')586 response = self.client.get(url)587 # Assert588 self.assertEqual(response.status_code, status.HTTP_200_OK) 589 self.assertEqual(len(response.data), 1)590 self.assertEqual(response.data[0]['fixture'], None) 591 def test_get_tournaments_current_or_last_fixture_200_OK_A(self):592 """593 We get the current or last fixture from all the tournaments of the site.594 Tournaments: 1595 Tournament hasn't started. Current fixture is the first.596 """597 # Tournament598 tournament = TournamentFactory()599 fixture_1 = FixtureFactory(tournament = tournament, number = 0)600 fixture_2 = FixtureFactory(tournament = tournament, number = 1)601 fixture_3 = FixtureFactory(tournament = tournament, number = 2)602 # Player603 player = PlayerFactory()604 token = Token.objects.get(user__username = player.username)605 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)606 # Player gets from All the Tournaments the Current Fixture607 url = reverse('allTournamentCurrentOrLastFixtureList')608 response = self.client.get(url)609 # Assert610 self.assertEqual(response.status_code, status.HTTP_200_OK) 611 self.assertEqual(len(response.data), 1)612 self.assertEqual(response.data[0]['tournament_name'], tournament.name)613 self.assertEqual(response.data[0]['fixture']['number'], fixture_1.number)614 def test_get_tournaments_current_or_last_fixture_200_OK_B(self):615 """616 We get the current or last fixture from all the tournaments of the site.617 Tournaments: 1618 Is Playing: True619 Tournament has started. The first fixture is being playing so the 620 Current fixture is still the first fixture.621 """622 # Tournament623 tournament = TournamentFactory()624 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_playing = True)625 fixture_2 = FixtureFactory(tournament = tournament, number = 1)626 fixture_3 = FixtureFactory(tournament = tournament, number = 2)627 # Player628 player = PlayerFactory()629 token = Token.objects.get(user__username = player.username)630 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)631 # Player gets from All the Tournaments the Current Fixture632 url = reverse('allTournamentCurrentOrLastFixtureList')633 response = self.client.get(url)634 # Assert635 self.assertEqual(response.status_code, status.HTTP_200_OK) 636 self.assertEqual(len(response.data), 1)637 self.assertEqual(response.data[0]['tournament_name'], tournament.name)638 self.assertEqual(response.data[0]['fixture']['number'], fixture_1.number)639 640 def test_get_tournaments_current_or_last_fixture_200_OK_C(self):641 """642 We get the current or last fixture from all the tournaments of the site.643 Tournaments: 1644 Is Playing: True645 Tournament has started. The first fixture has finished so it's the last fixture.646 """647 # Tournament648 tournament = TournamentFactory()649 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_playing = True, is_finished = True)650 fixture_2 = FixtureFactory(tournament = tournament, number = 1)651 fixture_3 = FixtureFactory(tournament = tournament, number = 2)652 # Player653 player = PlayerFactory()654 token = Token.objects.get(user__username = player.username)655 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)656 # Player gets from All the Tournaments the Current Fixture657 url = reverse('allTournamentCurrentOrLastFixtureList')658 response = self.client.get(url)659 # Assert660 self.assertEqual(response.status_code, status.HTTP_200_OK) 661 self.assertEqual(len(response.data), 1)662 self.assertEqual(response.data[0]['tournament_name'], tournament.name)663 self.assertEqual(response.data[0]['fixture']['number'], fixture_1.number)664 def test_get_tournaments_current_or_last_fixture_200_OK_D(self):665 """666 We get the current or last fixture from all the tournaments of the site.667 Tournaments: 1668 Is Playing: True669 Tournament is playing his last fixture.670 Current Fixture: fixture_3671 """672 # Tournament673 tournament = TournamentFactory()674 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_playing = True, is_finished = True)675 fixture_2 = FixtureFactory(tournament = tournament, number = 1, is_finished = True)676 fixture_3 = FixtureFactory(tournament = tournament, number = 2, is_playing = True)677 # Player678 player = PlayerFactory()679 token = Token.objects.get(user__username = player.username)680 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)681 # Player gets from All the Tournaments the Current Fixture682 url = reverse('allTournamentCurrentOrLastFixtureList')683 response = self.client.get(url)684 # Assert685 self.assertEqual(response.status_code, status.HTTP_200_OK) 686 self.assertEqual(len(response.data), 1)687 self.assertEqual(response.data[0]['tournament_name'], tournament.name)688 self.assertEqual(response.data[0]['fixture']['number'], fixture_3.number)689 def test_get_tournaments_current_or_last_fixture_200_OK_DA(self):690 """691 We get the current or last fixture from all the tournaments of the site.692 Tournaments: 1693 Is Playing: False694 Tournament is playing his last fixture.695 Current Fixture: fixture_2696 """697 # Tournament698 tournament = TournamentFactory()699 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_playing = True, is_finished = True)700 fixture_2 = FixtureFactory(tournament = tournament, number = 1, is_finished = True)701 fixture_3 = FixtureFactory(tournament = tournament, number = 2)702 # Player703 player = PlayerFactory()704 token = Token.objects.get(user__username = player.username)705 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)706 # Player gets from All the Tournaments the Current Fixture707 url = reverse('allTournamentCurrentOrLastFixtureList')708 response = self.client.get(url)709 # Assert710 self.assertEqual(response.status_code, status.HTTP_200_OK) 711 self.assertEqual(len(response.data), 1)712 self.assertEqual(response.data[0]['tournament_name'], tournament.name)713 self.assertEqual(response.data[0]['fixture']['number'], fixture_2.number) 714 def test_get_tournaments_current_or_last_fixture_200_OK_E(self):715 """716 We get the current or last fixture from all the tournaments of the site.717 Tournaments: 1718 Is Playing: True719 Tournament has finished720 Current Fixture is the last one.721 """722 # Tournament723 tournament = TournamentFactory()724 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_playing = True, is_finished = True)725 fixture_2 = FixtureFactory(tournament = tournament, number = 1, is_finished = True)726 fixture_3 = FixtureFactory(tournament = tournament, number = 2, is_playing = True, is_finished = True)727 # Player728 player = PlayerFactory()729 token = Token.objects.get(user__username = player.username)730 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)731 # Player gets from All the Tournaments the Current Fixture732 url = reverse('allTournamentCurrentOrLastFixtureList')733 response = self.client.get(url)734 # Assert735 self.assertEqual(response.status_code, status.HTTP_200_OK) 736 self.assertEqual(len(response.data), 1)737 self.assertEqual(response.data[0]['tournament_name'], tournament.name)738 self.assertEqual(response.data[0]['fixture']['number'], fixture_3.number) 739 def test_get_tournament_fixture_by_id_200_OK(self):740 # Tournament741 tournament = TournamentFactory()742 fixture_1 = FixtureFactory(tournament = tournament, number = 0)743 fixture_2 = FixtureFactory(tournament = tournament, number = 1)744 fixture_3 = FixtureFactory(tournament = tournament, number = 2)745 # Player746 player = PlayerFactory()747 token = Token.objects.get(user__username = player.username)748 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)749 # Player gets Tournament Fixture750 url = reverse('tournamentFixture', kwargs = {'pk': fixture_2.id })751 response = self.client.get(url)752 # Assert753 self.assertEqual(response.data['number'], fixture_2.number)754 self.assertEqual(response.status_code, status.HTTP_200_OK)755 def test_anon_get_tournament_401_UNAUTHORIZED(self):756 # Tournament757 tournament = TournamentFactory()758 fixture_1 = FixtureFactory(tournament = tournament, number = 0)759 # Player gets Tournament Fixture760 url = reverse('tournamentFixture', kwargs = {'pk': fixture_1.id })761 response = self.client.get(url)762 # Assert763 self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)764 def test_get_tournament_fixture_by_number_A_200_OK(self):765 # Tournament766 tournament = TournamentFactory()767 fixture_1 = FixtureFactory(tournament = tournament, number = 0)768 fixture_2 = FixtureFactory(tournament = tournament, number = 1)769 fixture_3 = FixtureFactory(tournament = tournament, number = 2)770 # Player771 player = PlayerFactory()772 token = Token.objects.get(user__username = player.username)773 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)774 # Player gets Tournament Fixture775 url = reverse('tournamentFixtureByNumber', kwargs = {'pk': tournament.id, 'number': fixture_2.number })776 response = self.client.get(url)777 # Assert778 self.assertEqual(response.data['number'], fixture_2.number)779 self.assertEqual(response.status_code, status.HTTP_200_OK)780 def test_get_tournament_fixture_by_number_B_200_OK(self):781 # Tournament782 tournament = TournamentFactory()783 fixture_1 = FixtureFactory(tournament = tournament, number = 0)784 fixture_2 = FixtureFactory(tournament = tournament, number = 1)785 fixture_3 = FixtureFactory(tournament = tournament, number = 2)786 # Player787 player = PlayerFactory()788 token = Token.objects.get(user__username = player.username)789 self.client.credentials(HTTP_AUTHORIZATION = 'Token ' + token.key)790 # Player gets Tournament Fixture791 url = reverse('tournamentFixtureByNumber', kwargs = {'pk': tournament.id, 'number': fixture_3.number })792 response = self.client.get(url)793 # Assert794 self.assertEqual(response.data['number'], fixture_3.number)795 self.assertEqual(response.status_code, status.HTTP_200_OK)796class FixtureTest(TestCase):797 def test_get_active_fixture_A(self):798 tournament = TournamentFactory()799 fixture_1 = FixtureFactory(tournament = tournament, number = 0)800 fixture_2 = FixtureFactory(tournament = tournament, number = 1)801 fixture_3 = FixtureFactory(tournament = tournament, number = 2)802 self.assertEqual(tournament.get_current_fixture(), fixture_1)803 def test_get_active_fixture_B(self):804 tournament = TournamentFactory()805 fixture_1 = FixtureFactory(tournament = tournament, is_finished = True, number = 0)806 fixture_2 = FixtureFactory(tournament = tournament, number = 1)807 fixture_3 = FixtureFactory(tournament = tournament, number = 2)808 self.assertEqual(tournament.get_current_fixture(), fixture_2)809 def test_get_active_fixture_C(self):810 tournament = TournamentFactory()811 fixture_1 = FixtureFactory(tournament = tournament, is_finished = True, number = 0)812 fixture_2 = FixtureFactory(tournament = tournament, is_finished = True, number = 1)813 fixture_3 = FixtureFactory(tournament = tournament, number = 2)814 self.assertEqual(tournament.get_current_fixture(), fixture_3)815 def test_get_past_fixtures_A(self):816 tournament = TournamentFactory()817 fixture_1 = FixtureFactory(tournament = tournament, number = 0)818 fixture_2 = FixtureFactory(tournament = tournament, number = 1)819 fixture_3 = FixtureFactory(tournament = tournament, number = 2)820 self.assertEqual(tournament.get_past_fixtures().count(), 0)821 def test_get_past_fixtures_B(self):822 tournament = TournamentFactory()823 fixture_1 = FixtureFactory(tournament = tournament, is_finished = True, number = 0)824 fixture_2 = FixtureFactory(tournament = tournament, number = 1)825 fixture_3 = FixtureFactory(tournament = tournament, number = 2)826 self.assertEqual(tournament.get_past_fixtures().count(), 1)827 def test_get_past_fixtures_C(self):828 tournament = TournamentFactory()829 fixture_1 = FixtureFactory(tournament = tournament, is_finished = True, number = 0)830 fixture_2 = FixtureFactory(tournament = tournament, is_finished = True, number = 1)831 fixture_3 = FixtureFactory(tournament = tournament, number = 2)832 self.assertEqual(tournament.get_past_fixtures().count(), 2)833 def test_get_past_fixtures_D(self):834 tournament = TournamentFactory()835 fixture_1 = FixtureFactory(tournament = tournament, is_finished = True, number = 0)836 fixture_2 = FixtureFactory(tournament = tournament, is_finished = True, number = 1)837 fixture_3 = FixtureFactory(tournament = tournament, is_finished = True, number = 2)838 self.assertEqual(tournament.get_past_fixtures().count(), 3)839 def test_get_future_fixtures_A(self):840 tournament = TournamentFactory()841 fixture_1 = FixtureFactory(tournament = tournament, number = 0)842 fixture_2 = FixtureFactory(tournament = tournament, number = 1)843 fixture_3 = FixtureFactory(tournament = tournament, number = 2)844 self.assertEqual(tournament.get_future_fixtures().count(), 3)845 def test_get_future_fixtures_B(self):846 tournament = TournamentFactory()847 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_finished = True)848 fixture_2 = FixtureFactory(tournament = tournament, number = 1)849 fixture_3 = FixtureFactory(tournament = tournament, number = 2)850 self.assertEqual(tournament.get_future_fixtures().count(), 2)851 def test_get_future_fixtures_C(self):852 tournament = TournamentFactory()853 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_finished = True)854 fixture_2 = FixtureFactory(tournament = tournament, number = 1, is_finished = True)855 fixture_3 = FixtureFactory(tournament = tournament, number = 2)856 self.assertEqual(tournament.get_future_fixtures().count(), 1)857 def test_get_future_fixtures_C(self):858 tournament = TournamentFactory()859 fixture_1 = FixtureFactory(tournament = tournament, number = 0, is_finished = True)860 fixture_2 = FixtureFactory(tournament = tournament, number = 1, is_finished = True)861 fixture_3 = FixtureFactory(tournament = tournament, number = 2, is_finished = True)862 self.assertEqual(tournament.get_future_fixtures().count(), 0)863class TournamentTest(TestCase):864 def test_get_tournament_teams(self):865 # Tournament866 tournament = TournamentFactory()867 fixture = FixtureFactory(tournament = tournament)868 team_1 = TeamFactory()869 team_2 = TeamFactory()870 match = MatchFactory(local_team = team_1, visitor_team = team_2, fixture = fixture) 871 tournament.teams.add(team_1)872 tournament.teams.add(team_2)873 teams = tournament.teams.all()874 self.assertEqual(len(teams), 2)875 def test_get_all_finished_matches_1(self):876 """877 Test Get all finished matches' team878 """879 880 tournament = TournamentFactory()881 fixture = FixtureFactory(tournament = tournament)882 team = TeamFactory() 883 match = MatchFactory(local_team = team, fixture = fixture, is_finished = True) 884 matches = team.get_all_finished_matches(tournament)885 self.assertEqual(matches[0], match)886 def test_get_all_finished_matches_2(self):887 """888 Test Get all finished matches' team889 """890 891 tournament = TournamentFactory()892 fixture = FixtureFactory(tournament = tournament)893 team = TeamFactory() 894 match_1 = MatchFactory(local_team = team, fixture = fixture, is_finished = True)895 match_2 = MatchFactory(local_team = team, fixture = fixture, is_finished = True) 896 matches = team.get_all_finished_matches(tournament)897 self.assertEqual(matches[0], match_1)898 self.assertEqual(matches[1], match_2) 899 900 def test_get_tournament_stats_1(self):901 """902 Test Local teams stats.903 904 Stats: W:1 D:0 L:0905 """906 tournament = TournamentFactory()907 fixture = FixtureFactory(tournament = tournament)908 team = TeamFactory() 909 match = MatchFactory(local_team = team,910 fixture = fixture,911 local_team_goals = 1,912 visitor_team_goals = 0,913 is_finished = True)914 stats = team.get_tournament_stats(tournament)915 self.assertEqual(stats['w'], 1)916 self.assertEqual(stats['d'], 0)917 self.assertEqual(stats['l'], 0)918 def test_get_tournament_stats_2(self):919 """920 Test Local teams stats.921 922 Stats: W:0 D:1 L:0923 """924 tournament = TournamentFactory()925 fixture = FixtureFactory(tournament = tournament)926 team = TeamFactory() 927 match = MatchFactory(local_team = team,928 fixture = fixture,929 local_team_goals = 1,930 visitor_team_goals = 1,931 is_finished = True)932 stats = team.get_tournament_stats(tournament)933 self.assertEqual(stats['w'], 0)934 self.assertEqual(stats['d'], 1)935 self.assertEqual(stats['l'], 0)936 def test_get_tournament_stats_3(self):937 """938 Test Local teams stats.939 940 Stats: W:0 D:0 L:1941 """942 tournament = TournamentFactory()943 fixture = FixtureFactory(tournament = tournament)944 team = TeamFactory() 945 match = MatchFactory(local_team = team,946 fixture = fixture,947 local_team_goals = 0,948 visitor_team_goals = 1, 949 is_finished = True)950 stats = team.get_tournament_stats(tournament)951 self.assertEqual(stats['w'], 0)952 self.assertEqual(stats['d'], 0)953 self.assertEqual(stats['l'], 1)954 def test_get_tournament_stats_unfinished_match_1(self):955 """956 Test Unfinished Game957 """958 tournament = TournamentFactory()959 fixture = FixtureFactory(tournament = tournament)960 team = TeamFactory() 961 match = MatchFactory(local_team = team,962 fixture = fixture,963 local_team_goals = 1,964 visitor_team_goals = 0)965 stats = team.get_tournament_stats(tournament)966 self.assertEqual(stats['w'], 0)967 self.assertEqual(stats['d'], 0)968 self.assertEqual(stats['l'], 0)969 def test_get_tournament_stats_multiples_matches(self):970 """971 Test Local teams stats.972 """973 tournament = TournamentFactory()974 fixture = FixtureFactory(tournament = tournament)975 team = TeamFactory()976 wins = [MatchFactory(local_team = team, fixture = fixture,local_team_goals = 2, visitor_team_goals = 1, is_finished = True)977 for x in xrange(random.randint(0, 10))]978 draws = [MatchFactory(local_team = team, fixture = fixture,local_team_goals = 2, visitor_team_goals = 2, is_finished = True)979 for x in xrange(random.randint(0, 10))] 980 losses = [MatchFactory(local_team = team, fixture = fixture,local_team_goals = 2, visitor_team_goals = 3, is_finished = True)981 for x in xrange(random.randint(0, 10))] 982 stats = team.get_tournament_stats(tournament)983 self.assertEqual(stats['w'], len(wins))984 self.assertEqual(stats['d'], len(draws))...

Full Screen

Full Screen

test_fixture_use.py

Source:test_fixture_use.py Github

copy

Full Screen

...51 @slash.use_fixtures(["fixture_3"])52 def fixture_2():53 slash.context.result.data['params'].append("fixture_2")54 @slash.fixture55 def fixture_3():56 slash.context.result.data['params'].append("fixture_3")57 @slash.use_fixtures(["fixture_1", "fixture_2"])58 @slash.fixture59 def fixture_4():60 slash.context.result.data['params'].append("fixture_4")61 @slash.use_fixtures(["fixture_4"])62 def test_a(fixture1: slash.use.fixture_1, fixture_2): # pylint: disable=unused-variable63 pass64 suite_builder.build().run().assert_success(1).with_data([{'params': ["fixture_1", "fixture_2", "fixture_3",65 "fixture_4"]}])66def test_fixture_cleanup(suite_builder):67 @suite_builder.first_file.add_code68 def __code__(): # pylint: disable=unused-variable69 import slash # pylint: disable=redefined-outer-name, reimported...

Full Screen

Full Screen

test_a.py

Source:test_a.py Github

copy

Full Screen

1import logging2import pytest3def test_a1(my_root_fixture, my_a_fixture):4 """Fixtures are automatically imported from `conftest.py`.5 Tests can use fixtures declared from the directory or6 parent directory the test is in."""7 logging.info("in test_a1()")8 logging.info(f"I have {my_root_fixture}")9 logging.info(f"I have {my_a_fixture}")10def test_a2(fixture_2):11 logging.info("in test_a2()")12 logging.info("fixture_2 evaluates to: %s", fixture_2)13def test_a3(fixture_3):14 logging.info("in test_a3()")15 logging.info("fixture_3 evaluates to: %s", fixture_3)16"""17Tests can't use fixtures declared in a directory that is not the current or parent.18```19def test_a2(my_b_fixture):20 logging.info("in test_a2()")21 logging.info(f"I have {my_b_fixture}")22```...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Slash automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful