Ejemplo n.º 1
0
        public async Task <List <ExecutedTestCase> > GetExecutedTestCasesAsync(List <TestCase> testCasesToBeExecuted)
        {
            var executedTestCases = new List <ExecutedTestCase>();
            var testCasesHistory  = await _testCaseHistoryRepository.GetAllAsync();

            foreach (var testCase in testCasesToBeExecuted)
            {
                if (testCasesHistory.Any(x => x.FullName.Equals(testCase.FullName)))
                {
                    var currentHistoryTestCase = testCasesHistory.FirstOrDefault(x => x.FullName.Equals(testCase.FullName));
                    executedTestCases.Add(new ExecutedTestCase(testCase, currentHistoryTestCase.AvgDuration));
                }
                else
                {
                    executedTestCases.Add(new ExecutedTestCase(testCase));
                }
            }

            return(executedTestCases);
        }
Ejemplo n.º 2
0
        public async Task PersistsHistoryToFileAsync()
        {
            var testCaseHistoryCollection = new List <TestCaseHistoryDto>();

            var testCasesHistoryEntries = await _testCaseHistoryRepository.GetAllAsync().ConfigureAwait(false);

            var historyEntries = await _testCaseHistoryEntryRepository.GetAllAsync().ConfigureAwait(false);

            foreach (var testCaseHistory in testCasesHistoryEntries)
            {
                var currentTestCaseHistoryEntries = historyEntries.Where(x => x.TestCaseHistoryId == testCaseHistory.TestCaseHistoryId);
                foreach (var testCaseHistoryEntry in currentTestCaseHistoryEntries)
                {
                    testCaseHistory.Durations.Add(testCaseHistoryEntry.AvgDuration);
                }
            }

            var fileContent = _jsonSerializer.Serialize(testCaseHistoryCollection);
            await _fileProvider.WriteAllTextAsync(GetTestCasesHistoryFileNamePath(), fileContent).ConfigureAwait(false);
        }
Ejemplo n.º 3
0
        private async Task CreateEnvironmentVariablesForCustomArgumentsAsync(Guid testRunId)
        {
            var testRunCustomArguments = (await _testRunCustomArgumentRepository.GetAllAsync()).Where(x => x.TestRunId.Equals(testRunId));

            if (testRunCustomArguments.Any())
            {
                foreach (var testRunCustomArgument in testRunCustomArguments)
                {
                    try
                    {
                        _environmentService.SetEnvironmentVariable(testRunCustomArgument.Key, testRunCustomArgument.Value);
                    }
                    catch (SecurityException)
                    {
                        _consoleProvider.WriteLine("You need to start the test agent in elevated mode otherwise it cannot set system environment variables as custom arguments.");
                        throw;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public async Task <IEnumerable <ClientViewModel> > GetAllAsync(int page, int pageSize)
        {
            var clients = await _serviceClient.GetAllAsync(page, pageSize);

            return(_mapperClient.ListEntityToViewModel(clients));
        }